* [PATCH] staging: rtl8192u: remove redundant null check on array 'data'
@ 2019-04-04 9:32 Colin King
2019-04-04 9:41 ` Dan Carpenter
2019-04-04 10:16 ` Mukesh Ojha
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-04-04 9:32 UTC (permalink / raw)
To: Greg Kroah-Hartman, John Whitmore, devel; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The NULL check on ram->u.wpa_ie.data is redudant as data is
zero-length array and is not a pointer, so it can't be null.
Remove the check.
Addresses-Coverity: ("Array compared against 0")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 944c8894f9ff..c4a4f118f547 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -2659,8 +2659,7 @@ static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
{
u8 *buf;
- if (param->u.wpa_ie.len > MAX_WPA_IE_LEN ||
- (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL))
+ if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || param->u.wpa_ie.len)
return -EINVAL;
if (param->u.wpa_ie.len) {
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8192u: remove redundant null check on array 'data'
2019-04-04 9:32 [PATCH] staging: rtl8192u: remove redundant null check on array 'data' Colin King
@ 2019-04-04 9:41 ` Dan Carpenter
2019-04-04 10:16 ` Mukesh Ojha
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-04-04 9:41 UTC (permalink / raw)
To: Colin King
Cc: Greg Kroah-Hartman, John Whitmore, devel, kernel-janitors, linux-kernel
On Thu, Apr 04, 2019 at 10:32:57AM +0100, Colin King wrote:
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 944c8894f9ff..c4a4f118f547 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -2659,8 +2659,7 @@ static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
> {
> u8 *buf;
>
> - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN ||
> - (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL))
> + if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || param->u.wpa_ie.len)
> return -EINVAL;
Nope... :P Don't do that...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8192u: remove redundant null check on array 'data'
2019-04-04 9:32 [PATCH] staging: rtl8192u: remove redundant null check on array 'data' Colin King
2019-04-04 9:41 ` Dan Carpenter
@ 2019-04-04 10:16 ` Mukesh Ojha
1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2019-04-04 10:16 UTC (permalink / raw)
To: Colin King, Greg Kroah-Hartman, John Whitmore, devel
Cc: kernel-janitors, linux-kernel
On 4/4/2019 3:02 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The NULL check on ram->u.wpa_ie.data is redudant as data is
s/redudant/redundant
> zero-length array and is not a pointer, so it can't be null.
> Remove the check.
>
> Addresses-Coverity: ("Array compared against 0")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
fix the commit text minor err
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cheers,
-Mukesh
> ---
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 944c8894f9ff..c4a4f118f547 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -2659,8 +2659,7 @@ static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
> {
> u8 *buf;
>
> - if (param->u.wpa_ie.len > MAX_WPA_IE_LEN ||
> - (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL))
> + if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || param->u.wpa_ie.len)
> return -EINVAL;
>
> if (param->u.wpa_ie.len) {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-04 10:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 9:32 [PATCH] staging: rtl8192u: remove redundant null check on array 'data' Colin King
2019-04-04 9:41 ` Dan Carpenter
2019-04-04 10:16 ` Mukesh Ojha
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).