[PATCH 1/2] staging: tidspbridge: replace strict_strtol() with kstrtol()
Jingoo Han
jg1.han at samsung.com
Tue Jul 23 10:45:07 UTC 2013
On Tuesday, July 23, 2013 7:34 PM, Dan Carpenter wrote:
> 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 at samsung.com>
> > ---
> > 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.
Do you mean '(long *)&req'?
Sorry, but I cannot understand fully what you mean. :(
Could you let me know how to solve this?
>
> Also the error handling is pretty bogus. I know you didn't
> introduce this, but could fix and resend anyway.
If there is no error handling, it will make build warning.
Because, __must_check is added to kstrtol() as below:
static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
How about adding this to commit message?
Best regards
Jingoo Han
More information about the devel
mailing list