Skip to content

Commit aa3233e

Browse files
arndbgregkh
authored andcommitted
staging: r8188eu: fix -Wrestrict warnings
Adding back the nonstandard ioctl commands caused -Wrestrict warnings when building with 'make W=1': drivers/staging/r8188eu/os_dep/ioctl_linux.c: In function 'rtw_mp_read_rf': drivers/staging/r8188eu/os_dep/ioctl_linux.c:5515:27: error: 'sprintf' argument 3 overlaps destination object 'extra' [-Werror=restrict] 5515 | sprintf(extra, "%s %d", extra, strtou); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/staging/r8188eu/os_dep/ioctl_linux.c:5470:54: note: destination object referenced by 'restrict'-qualified argument 1 was declared here 5470 | struct iw_point *wrqu, char *extra) | ~~~~~~^~~~~ Change these to the same construct used elsewhere in that driver, with an offset to the string to make the warning go away. The ioctl commands were previously removed, and it's unlikely that anything is actually using them, so ideally I would prefer to have them removed again. The lack of range checking of the 'extra' output buffer is also slightly worrying, but I did not check whether this could cause harm. Fixes: 2b42bd5 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver") Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 92dc0b1 commit aa3233e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/staging/r8188eu/os_dep/ioctl_linux.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5372,8 +5372,8 @@ static int rtw_mp_read_reg(struct net_device *dev,
53725372

53735373
pnext++;
53745374
if (*pnext != '\0') {
5375-
strtout = simple_strtoul(pnext, &ptmp, 16);
5376-
sprintf(extra, "%s %d", extra, strtout);
5375+
strtout = simple_strtoul(pnext, &ptmp, 16);
5376+
sprintf(extra + strlen(extra), " %d", strtout);
53775377
} else {
53785378
break;
53795379
}
@@ -5405,7 +5405,7 @@ static int rtw_mp_read_reg(struct net_device *dev,
54055405
pnext++;
54065406
if (*pnext != '\0') {
54075407
strtout = simple_strtoul(pnext, &ptmp, 16);
5408-
sprintf(extra, "%s %d", extra, strtout);
5408+
sprintf(extra + strlen(extra), " %d", strtout);
54095409
} else {
54105410
break;
54115411
}
@@ -5512,7 +5512,7 @@ static int rtw_mp_read_rf(struct net_device *dev,
55125512
pnext++;
55135513
if (*pnext != '\0') {
55145514
strtou = simple_strtoul(pnext, &ptmp, 16);
5515-
sprintf(extra, "%s %d", extra, strtou);
5515+
sprintf(extra + strlen(extra), " %d", strtou);
55165516
} else {
55175517
break;
55185518
}

0 commit comments

Comments
 (0)