]> git.baikalelectronics.ru Git - kernel.git/commit
media: hdpvr: fix error value returns in hdpvr_read
authorNiels Dossche <dossche.niels@gmail.com>
Tue, 14 Jun 2022 17:50:02 +0000 (18:50 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 27 Jun 2022 08:02:50 +0000 (09:02 +0100)
commit9d4cf95e749c6f25e0a52bb7fc1622e63848c843
tree8d6fcbf1ab2b196e3a92128e9ec09a79e86d2334
parent242d4714991f268a5f3c08a9b3941eb19a7c4017
media: hdpvr: fix error value returns in hdpvr_read

Error return values are supposed to be negative in hdpvr_read. Most
error returns are currently handled via an unsigned integer "ret". When
setting a negative error value to "ret", the value actually becomes a
large positive value, because "ret" is unsigned. Later on, the "ret"
value is returned. But as ssize_t is a 64-bit signed number, the error
return value stays a large positive integer instead of a negative
integer. This can cause an error value to be interpreted as the read
size, which can cause a buffer overread for applications relying on the
returned size.

Fixes: 0db7fdbfe2fe ("V4L/DVB (11096): V4L2 Driver for the Hauppauge HD PVR usb capture device")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/usb/hdpvr/hdpvr-video.c