]> git.baikalelectronics.ru Git - kernel.git/commit
media: i2c: ccs: Check rules is non-NULL
authorSakari Ailus <sakari.ailus@linux.intel.com>
Sat, 29 Jul 2023 18:59:25 +0000 (20:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:43:00 +0000 (09:43 +0200)
commitceedc62a3bc89f66af64320c6ceab8e9014746c6
tree5c2f4f9a6b8bcc33f62f08201c5e9617885162cb
parentfea9dd8653ff39ce383c54e747bde4c39289b4ad
media: i2c: ccs: Check rules is non-NULL

commit 607bcc4213d998d051541d8f10b5bbb7d546c0be upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/i2c/ccs/ccs-data.c