Re: [PATCH v2] staging: rtl8192u: r8192U_core: Fix for possible null pointer dereference

From: Dan Carpenter
Date: Thu Feb 05 2015 - 07:28:18 EST


I don't know if this patch was merged before Greg cleaned out his inbox.

It's a good patch if you could just clean it up a bit.

On Thu, Jan 29, 2015 at 07:59:12PM +0100, Rickard Strandqvist wrote:
> Fix a possible null pointer dereference, there is
> otherwise a risk of a possible null pointer dereference.

The change log should say that "driver_info" is the NULL pointer. It
should say that by default stats->RxIs40MHzPacket is zero (as opposed to
uninitialized memory).

>
> This was found using a static code analysis program called cppcheck
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
> ---
> drivers/staging/rtl8192u/r8192U_core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index e031a25..4a29237 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -4476,11 +4476,11 @@ static void query_rxdesc_status(struct sk_buff *skb,
>
> /* for debug 2008.5.29 */
>
> - //added by vivi, for MP, 20080108
> - stats->RxIs40MHzPacket = driver_info->BW;
> - if (stats->RxDrvInfoSize != 0)
> + if (driver_info && stats->RxDrvInfoSize != 0) {
> + //added by vivi, for MP, 20080108

Delete these kinds of comments, please.


> + stats->RxIs40MHzPacket = driver_info->BW;
> TranslateRxSignalStuff819xUsb(skb, stats, driver_info);
> -
> + }

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/