Commit 39c116dc authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: atomisp: potential underflow in atomisp_get_metadata_by_type()

md_type is an enum.  On my tests, GCC treats it as unsigned but
according to the C standard it's an implementation dependant thing so we
should check for negatives.

Fixes: a49d2536 ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cfd23945
...@@ -3004,7 +3004,7 @@ int atomisp_get_metadata_by_type(struct atomisp_sub_device *asd, int flag, ...@@ -3004,7 +3004,7 @@ int atomisp_get_metadata_by_type(struct atomisp_sub_device *asd, int flag,
return 0; return 0;
md_type = md->type; md_type = md->type;
if (md_type >= ATOMISP_METADATA_TYPE_NUM) if (md_type < 0 || md_type >= ATOMISP_METADATA_TYPE_NUM)
return -EINVAL; return -EINVAL;
/* This is done in the atomisp_buf_done() */ /* This is done in the atomisp_buf_done() */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment