Re: [PATCH 1/2] staging: tidspbridge: replace strict_strtol() with kstrtol()

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

 



On Tue, Jul 23, 2013 at 07:16:21PM +0900, Jingoo Han wrote:
> The usage of strict_strtol() is not preferred, because
> strict_strtol() is obsolete. Thus, kstrtol() should be
> used.
> 
> Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
> ---
>  drivers/staging/tidspbridge/pmgr/dbll.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
> index c191ae2..82de57a 100644
> --- a/drivers/staging/tidspbridge/pmgr/dbll.c
> +++ b/drivers/staging/tidspbridge/pmgr/dbll.c
> @@ -1120,8 +1120,10 @@ static int dbll_rmm_alloc(struct dynamic_loader_allocate *this,
>  	   or DYN_EXTERNAL, then mem granularity information is present
>  	   within the section name - only process if there are at least three
>  	   tokens within the section name (just a minor optimization) */
> -	if (count >= 3)
> -		strict_strtol(sz_last_token, 10, (long *)&req);
> +	if (count >= 3) {
> +		if (kstrtol(sz_last_token, 10, (long *)&req))
                                               ^^^^^^^^^^^^
This bug is in the original code as well but you're passing a 32 bit
pointer to kstrtol() which sets 64 bits on x86_64.  So it will
corrupt memory.

Also the error handling is pretty bogus.  I know you didn't
introduce this, but could fix and resend anyway.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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