Skip to content

Commit dc6b845

Browse files
Mauro Carvalho Chehabtorvalds
authored andcommitted
si4713-i2c: avoid potential buffer overflow on si4713
While compiling it with Fedora 15, I noticed this issue: inlined from ‘si4713_write_econtrol_string’ at drivers/media/radio/si4713-i2c.c:1065:24: arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error: copy_from_user() buffer size is not provably correct Cc: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Reviewed-by: Eugene Teo <eugeneteo@kernel.sg> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 524196d commit dc6b845

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/media/radio/si4713-i2c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ static int si4713_write_econtrol_string(struct si4713_device *sdev,
10331033
char ps_name[MAX_RDS_PS_NAME + 1];
10341034

10351035
len = control->size - 1;
1036-
if (len > MAX_RDS_PS_NAME) {
1036+
if (len < 0 || len > MAX_RDS_PS_NAME) {
10371037
rval = -ERANGE;
10381038
goto exit;
10391039
}
@@ -1057,7 +1057,7 @@ static int si4713_write_econtrol_string(struct si4713_device *sdev,
10571057
char radio_text[MAX_RDS_RADIO_TEXT + 1];
10581058

10591059
len = control->size - 1;
1060-
if (len > MAX_RDS_RADIO_TEXT) {
1060+
if (len < 0 || len > MAX_RDS_RADIO_TEXT) {
10611061
rval = -ERANGE;
10621062
goto exit;
10631063
}

0 commit comments

Comments
 (0)