Re: [PATCH 11/21] staging: brcm80211: replace simple_strtoul with strict_strtoul

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 25, 2011 at 11:31:30AM +0100, Arend van Spriel wrote:
> By checkpatch recommendation using strict_strtoul now.
> 
> Reviewed-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
> Reviewed-by: Brett Rudley <brudley@xxxxxxxxxxxx>
> Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
> ---
>  drivers/staging/brcm80211/brcmsmac/wl_mac80211.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
> index 5f881a9..f50b0c1 100644
> --- a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
> +++ b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
> @@ -38,7 +38,7 @@
>  #include "phy/phy_version.h"
>  #include "wlc_key.h"
>  #include "sbhndpio.h"
> -#include "phy/wlc_phy_hal.h"
> +#include "phy/wlc_phy_int.h"
>  #include "wlc_channel.h"
>  #include "wlc_scb.h"
>  #include "wlc_pub.h"
> @@ -1290,17 +1290,17 @@ static int __init wl_module_init(void)
>  	else {
>  		char *var = getvar(NULL, "wl_msglevel");
>  		if (var)
> -			wl_msg_level = simple_strtoul(var, NULL, 0);
> +			strict_strtoul(var, 0,
> +				(long unsigned int *)&wl_msg_level);
                                               ^^^
1) "int" Not needed.

2) This will cause memory corruption if long is 64 bit and int is 32
bit.  (ie x86_64).  The function modifies 64 bits instead of 32.

3) If you don't check the return value of strict_strtoul() then it's
almost equivalent to simple_strtoul(). 

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux