History log of /linux-master/drivers/media/i2c/ccs/ccs-data.c
Revision Date Author Comments
# 607bcc42 29-Jul-2023 Sakari Ailus <sakari.ailus@linux.intel.com>

media: i2c: ccs: Check rules is non-NULL

Fix the following smatch warning:

drivers/media/i2c/ccs/ccs-data.c:524 ccs_data_parse_rules() warn: address
of NULL pointer 'rules'

The CCS static data rule parser does not check an if rule has been
obtained before checking for other rule types (which depend on the if
rule). In practice this means parsing invalid CCS static data could lead
to dereferencing a NULL pointer.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Fixes: a6b396f410b1 ("media: ccs: Add CCS static data parser library")
Cc: stable@vger.kernel.org # for 5.11 and up
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# ae56e038 05-Jan-2021 Sakari Ailus <sakari.ailus@linux.intel.com>

media: ccs: Make (non-)use of uninitialised variables more robust

GCC with W=2 level of kernel compiler warnings warns about the use of
uninitialised variables in a few locations. While these uninitialised
variables were not used in reality, this still produced compiler warnings.

Address this by assigning the variables to NULL and checking for NULL in
places it is not expected, returning -EIO in that case. This provides
at least some sanity checking at runtime as the compiler appears unable to
do that at compile time.

Reported-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 38cfa52c 10-Dec-2020 Sakari Ailus <sakari.ailus@linux.intel.com>

media: ccs: Small definition cleanup

struct device is used in ccs-data.h but no definition is included. Add a
forward definition.

Also ccs-data.c includes linux/types.h but this is already included in
ccs-data.h which ccs-data.c includes. Do don't include linux/types.h in
ccs-data.c.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 1bc0b1ba 15-Dec-2020 Sakari Ailus <sakari.ailus@linux.intel.com>

media: ccs: Get static data version minor correctly

Fix obtaining CCS static data version minor part correctly. Instead, the
upper 8 bits were obtained from the major version number.

Fixes: a6b396f410b1 ("media: ccs: Add CCS static data parser library")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# a6b396f4 14-Feb-2020 Sakari Ailus <sakari.ailus@linux.intel.com>

media: ccs: Add CCS static data parser library

Add a parser library for parsing the CCS static data format.

The library may be also compiled in user space as the format has uses also
in the user space. Therefore it is dual licensed under the 3-clause BSD
license as well.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>