linux/drivers/media
Mauro Carvalho Chehab a47686636d media: smsusb: better handle optional alignment
Most Siano devices require an alignment for the response.

Changeset f3be52b0056a ("media: usb: siano: Fix general protection fault in smsusb")
changed the logic with gets such aligment, but it now produces a
sparce warning:

drivers/media/usb/siano/smsusb.c: In function 'smsusb_init_device':
drivers/media/usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function [-Wmaybe-uninitialized]
  447 |   dev->response_alignment = in_maxp - sizeof(struct sms_msg_hdr);
      |                             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

The sparse message itself is bogus, but a broken (or fake) USB
eeprom could produce a negative value for response_alignment.

So, change the code in order to check if the result is not
negative.

Fixes: 31e0456de5 ("media: usb: siano: Fix general protection fault in smsusb")
CC: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24 21:09:20 +02:00
..
cec media: cec-notifier: add cec_notifier_parse_hdmi_phandle helper 2019-04-22 13:09:59 -04:00
common media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
dvb-core media: dvbdev: remove double-unlock 2019-03-28 14:36:14 -04:00
dvb-frontends media: remove unneeded header search paths 2019-05-18 11:49:56 +09:00
firewire media: firewire: Fix app_info parameter type in avc_ca{,_app}_info 2018-12-05 05:34:33 -05:00
i2c media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
mmc media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
pci media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
platform media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
radio media: remove unneeded header search paths 2019-05-18 11:49:56 +09:00
rc media updates for v5.1-rc1 2019-05-08 11:13:17 -07:00
spi media: prefix header search paths with $(srctree)/ 2019-05-18 11:49:56 +09:00
tuners media: tuners: fix several typos 2019-03-01 09:40:29 -05:00
usb media: smsusb: better handle optional alignment 2019-05-24 21:09:20 +02:00
v4l2-core mm/gup: replace get_user_pages_longterm() with FOLL_LONGTERM 2019-05-14 09:47:45 -07:00
Kconfig media: Kconfig files: use the right help coding style 2019-03-20 06:47:51 -04:00
Makefile media: Media Device Allocator API 2019-04-22 11:18:26 -04:00
media-dev-allocator.c media: Media Device Allocator API 2019-04-22 11:18:26 -04:00
media-device.c media: Add a Kconfig option for the Request API 2018-12-05 13:07:43 -05:00
media-devnode.c media: Clear devnode->media_dev holding media_devnode_lock 2019-04-22 11:24:33 -04:00
media-entity.c media: replace WARN_ON in __media_pipeline_start() 2019-03-19 14:01:08 -04:00
media-request.c media updates for v5.1-rc1 2019-05-08 11:13:17 -07:00