staging: rtl8192e: use explicitly signed char
PATCH 1/1 staging: rtl8192e: use explicitly signed char
With char becoming unsigned by default, and with char alone being ambiguous and based on architecture, signed chars need to be marked explicitly as such. In this case, passing char *extra is part of the iw API, and that extra is mostly intended to be somewhat opaque. So just cast to s8 * for the sign test. This fixes warnings like:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459 rtllib_wx_set_essid() warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'
--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -1
@@ -456,7 +456,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, }for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { +if (((s8 *)extra)[i] <0 ) { ret =-1 ; goto out; }
Signature · 1 line
2.38.1
Quoted 20 lines · Jason A. Donenfeld
With char becoming unsigned by default, and with
charalone being ambiguous and based on architecture, signed chars need to be marked explicitly as such. In this case, passingchar *extrais part of the iw API, and that extra is mostly intended to be somewhat opaque. So just cast tos8 *for the sign test. This fixes warnings like:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-0
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_essid(struct rtllib_device *ieee, · line 459
Quoted 5 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-1@@ -456,7 +456,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, }for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { +if (((s8 *)extra)[i] <0 ) {
I agree with Linus that this if statement is nonsense and should just be deleted.
regards,
dan carpenter
Quoted 3 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-0ret =-1 ; goto out; }
Greg Kroah-Hartman
maintainerQuoted 23 lines · Dan Carpenter
Quoted 22 lines · Jason A. Donenfeld
With char becoming unsigned by default, and with
charalone being ambiguous and based on architecture, signed chars need to be marked explicitly as such. In this case, passingchar *extrais part of the iw API, and that extra is mostly intended to be somewhat opaque. So just cast tos8 *for the sign test. This fixes warnings like:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-0@@ -456,7 +456,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, }
Quoted 6 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_essid(struct rtllib_device *ieee, · line 459
Quoted 3 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-1for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { +if (((s8 *)extra)[i] <0 ) {I agree with Linus that this if statement is nonsense and should just be deleted.
Yeah, I agree as well, let's just delete this invalid check. No other wifi driver cares about ssid characters like this.
thanks,
greg k-h
PATCH v2 1/1 staging: rtl8192e: remove bogus ssid character sign test
This error triggers on some architectures with unsigned char types:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459 rtllib_wx_set_essid() warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'
But actually, the entire test is bogus, as ssids don't have any sign validity rules like that. So just remove this check look all together.
---
Changes v1->v2:
- Remove ssid sign test entirely rather than casting to s8 *.
drivers/staging/rtl8192e/rtllib_softmac_wx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -8
@@ -439,7 +439,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret = 0, len, i; + int ret = 0, len;short proto_started;unsigned long flags;
@@ -455,13 +455,6 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, goto out; } -for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { - ret =-1 ; - goto out; - } - } -if (proto_started)rtllib_stop_protocol (ieee, true);
Signature · 1 line
2.38.1
Re: [PATCH v2] staging: rtl8192e: remove bogus ssid character sign test
Quoted 7 lines · Jason A. Donenfeld
This error triggers on some architectures with unsigned
chartypes:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'But actually, the entire test is bogus, as ssids don't have any sign validity rules like that. So just remove this check look all together.
Quoted 6 lines
Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>---
Changesv1->v2:
- Remove ssid sign test entirely rather than casting tos8 *.
Thanks!
regards,
dan carpenter
Re: [PATCH v2] staging: rtl8192e: remove bogus ssid character sign test
In reply to Jason A. DonenfeldQuoted 33 lines · Jason A. Donenfeld
This error triggers on some architectures with unsigned
chartypes:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'But actually, the entire test is bogus, as ssids don't have any sign validity rules like that. So just remove this check look all together.
Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>---
Changesv1->v2:
- Remove ssid sign test entirely rather than casting tos8 *.drivers/staging/rtl8192e/rtllib_softmac_wx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-1@@ -439,7 +439,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret = 0, len, i; + int ret = 0, len;short proto_started;unsigned long flags;@@ -455,13 +455,6 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, goto out; }
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_essid(struct rtllib_device *ieee, · line 459
Quoted 10 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-7-for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { - ret =-1 ; - goto out; - } - } -if (proto_started)rtllib_stop_protocol (ieee, true);
This patch cannot be applied on:
[PATCH] staging: rtl8192e: use explicitly signed char On 10/24/22 18:30, Jason A. Donenfeld
As line 456 was changed.
Bye Philipp
Quoted 1 line
Greg KH
maintainerRe: [PATCH v2] staging: rtl8192e: remove bogus ssid character sign test
Quoted 38 lines · Philipp Hortmann
Quoted 37 lines · Jason A. Donenfeld
This error triggers on some architectures with unsigned
chartypes:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'But actually, the entire test is bogus, as ssids don't have any sign validity rules like that. So just remove this check look all together.
Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>---
Changesv1->v2:
- Remove ssid sign test entirely rather than casting tos8 *.drivers/staging/rtl8192e/rtllib_softmac_wx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-7@@ -439,7 +439,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret = 0, len, i; + int ret = 0, len;short proto_started;unsigned long flags;@@ -455,13 +455,6 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, goto out; } -for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { - ret =-1 ; - goto out; - } - }
Quoted 8 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_essid(struct rtllib_device *ieee, · line 459
Quoted 3 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-1-if (proto_started)rtllib_stop_protocol (ieee, true);This patch cannot be applied on:
[PATCH] staging: rtl8192e: use explicitly signed char On 10/24/22 18:30, Jason A. Donenfeld
As line 456 was changed.
This now in my staging-linus branch, so perhaps you applied it to the wrong one.
thanks,
greg k-h
Re: [PATCH v2] staging: rtl8192e: remove bogus ssid character sign test
In reply to Philipp HortmannQuoted 36 lines · Philipp Hortmann
Quoted 34 lines · Jason A. Donenfeld
This error triggers on some architectures with unsigned
chartypes:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'But actually, the entire test is bogus, as ssids don't have any sign validity rules like that. So just remove this check look all together.
Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>---
Changesv1->v2:
- Remove ssid sign test entirely rather than casting tos8 *.drivers/staging/rtl8192e/rtllib_softmac_wx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-1@@ -439,7 +439,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret = 0, len, i; + int ret = 0, len;short proto_started;unsigned long flags;@@ -455,13 +455,6 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, goto out; }
Quoted 12 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_essid(struct rtllib_device *ieee, · line 459
Quoted 9 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-7-for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { - ret =-1 ; - goto out; - } - } -if (proto_started)rtllib_stop_protocol (ieee, true);This patch cannot be applied on:
[PATCH] staging: rtl8192e: use explicitly signed char
They're mutually exclusive, which is why this one here was marked as a v2 and sent in reply to that one. Greg picked up the v2 and all is well.
Jason
Quoted 20 lines · Jason A. Donenfeld
With char becoming unsigned by default, and with
charalone being ambiguous and based on architecture, signed chars need to be marked explicitly as such. In this case, passingchar *extrais part of the iw API, and that extra is mostly intended to be somewhat opaque. So just cast tos8 *for the sign test. This fixes warnings like:
drivers/staging/rtl8192e/rtllib_softmac_wx.c:459rtllib_wx_set_essid()warn: impossible condition '(extra[i] < 0) => (0-255 < 0)'Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Jason A. Donenfeld <[email protected]>--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/rtl8192e/rtllib_softmac_wx.c +0
-0
drivers/staging/rtl8192e/rtllib_softmac_wx.c int rtllib_wx_set_essid(struct rtllib_device *ieee, · line 462
Quoted 8 lines
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1
-1@@ -456,7 +456,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, }for (i =0 ; i < len; i++) { -if (extra[i] <0 ) { +if (((s8 *)extra)[i] <0 ) { ret =-1 ; goto out; }