* [PATCH] staging: rtl8712: fix boundary condition for n
@ 2019-10-02 17:05 Rohit Sarkar
2019-10-03 13:26 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Rohit Sarkar @ 2019-10-02 17:05 UTC (permalink / raw)
To: gregkh, Larry.Finger, florian.c.schilhabel, driverdev-devel; +Cc: dan.carpenter
Now that snprintf is replaced by scnprintf n >= MAX_WPA_IE_LEN doesn't
make sense as the maximum value n can take is MAX_WPA_IE_LEN.
Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
---
drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index b3263e953f05..363b82e3e7c6 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -144,7 +144,7 @@ static noinline_for_stack char *translate_scan_wpa(struct iw_request_info *info,
for (i = 0; i < wpa_len; i++) {
n += scnprintf(buf + n, MAX_WPA_IE_LEN - n,
"%02x", wpa_ie[i]);
- if (n >= MAX_WPA_IE_LEN)
+ if (n == MAX_WPA_IE_LEN-1)
break;
}
memset(iwe, 0, sizeof(*iwe));
@@ -164,7 +164,7 @@ static noinline_for_stack char *translate_scan_wpa(struct iw_request_info *info,
for (i = 0; i < rsn_len; i++) {
n += scnprintf(buf + n, MAX_WPA_IE_LEN - n,
"%02x", rsn_ie[i]);
- if (n >= MAX_WPA_IE_LEN)
+ if (n == MAX_WPA_IE_LEN-1)
break;
}
memset(iwe, 0, sizeof(*iwe));
--
2.17.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: rtl8712: fix boundary condition for n
2019-10-02 17:05 [PATCH] staging: rtl8712: fix boundary condition for n Rohit Sarkar
@ 2019-10-03 13:26 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2019-10-03 13:26 UTC (permalink / raw)
To: Rohit Sarkar; +Cc: gregkh, driverdev-devel, florian.c.schilhabel, Larry.Finger
On Wed, Oct 02, 2019 at 10:35:19PM +0530, Rohit Sarkar wrote:
> Now that snprintf is replaced by scnprintf n >= MAX_WPA_IE_LEN doesn't
> make sense as the maximum value n can take is MAX_WPA_IE_LEN.
>
> Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
> ---
Thanks!
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-03 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 17:05 [PATCH] staging: rtl8712: fix boundary condition for n Rohit Sarkar
2019-10-03 13:26 ` Dan Carpenter
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).