* [PATCH] staging: atomisp: potential underflow in atomisp_get_metadata_by_type()
@ 2017-03-13 12:34 Dan Carpenter
2017-03-13 17:52 ` Alan Cox
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-03-13 12:34 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Alan Cox
Cc: Greg Kroah-Hartman, linux-media, devel, kernel-janitors
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: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index d9a5c24633cb..0d77ebc5c865 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -3005,7 +3005,7 @@ int atomisp_get_metadata_by_type(struct atomisp_sub_device *asd, int flag,
return 0;
md_type = md->type;
- if (md_type >= ATOMISP_METADATA_TYPE_NUM)
+ if (md_type < 0 || md_type >= ATOMISP_METADATA_TYPE_NUM)
return -EINVAL;
/* This is done in the atomisp_buf_done() */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: atomisp: potential underflow in atomisp_get_metadata_by_type()
2017-03-13 12:34 [PATCH] staging: atomisp: potential underflow in atomisp_get_metadata_by_type() Dan Carpenter
@ 2017-03-13 17:52 ` Alan Cox
0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2017-03-13 17:52 UTC (permalink / raw)
To: Dan Carpenter, Mauro Carvalho Chehab
Cc: Greg Kroah-Hartman, linux-media, devel, kernel-janitors
On Mon, 2017-03-13 at 15:34 +0300, Dan Carpenter wrote:
> 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.
Can do but the kernel assumes GNU C everywhere else.
Acked-by: Alan Cox <alan@linux.intel.com>
Alan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-13 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-13 12:34 [PATCH] staging: atomisp: potential underflow in atomisp_get_metadata_by_type() Dan Carpenter
2017-03-13 17:52 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).