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

Dan Carpenter error27 at gmail.com
Fri Feb 25 12:17:50 UTC 2011


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 at broadcom.com>
> Reviewed-by: Brett Rudley <brudley at broadcom.com>
> Signed-off-by: Arend van Spriel <arend at broadcom.com>
> ---
>  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



More information about the devel mailing list