| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 RE: [PATCH -next 2/3] xen: balloon: Replaced simple_strtoull() with kstrtoull()
 
To: 'Chen Huang' <chenhuang5@xxxxxxxxxx>, Michael Ellerman	<mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>,	"Paul Mackerras" <paulus@xxxxxxxxx>, Boris Ostrovsky	<boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Mark Fasheh <mark@xxxxxxxxxx>, Joel Becker <jlbec@xxxxxxxxxxxx>, Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>, Nathan Lynch <nathanl@xxxxxxxxxxxxx>, "Andrew Donnellan" <ajd@xxxxxxxxxxxxx>, Alexey Kardashevskiy <aik@xxxxxxxxx>, "Andrew Morton" <akpm@xxxxxxxxxxxxxxxxxxxx>,	Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, Yang Yingliang <yangyingliang@xxxxxxxxxx>, Masahiro Yamada <masahiroy@xxxxxxxxxx>,	Dan Carpenter <dan.carpenter@xxxxxxxxxx>From: David Laight <David.Laight@xxxxxxxxxx>Date: Thu, 27 May 2021 14:10:21 +0000Accept-language: en-GB, en-USAuthentication-results: relay.mimecast.com;	auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@xxxxxxxxxxCc: "linuxppc-dev@xxxxxxxxxxxxxxxx" <linuxppc-dev@xxxxxxxxxxxxxxxx>,	"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,	"xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>,	"ocfs2-devel@xxxxxxxxxxxxxx" <ocfs2-devel@xxxxxxxxxxxxxx>Delivery-date: Thu, 27 May 2021 14:10:38 +0000List-id: Xen developer discussion <xen-devel.lists.xenproject.org>Thread-index: AQHXUg74rK/OAxNe1kmGDaODmfSqv6r3X4NAThread-topic: [PATCH -next 2/3] xen: balloon: Replaced simple_strtoull() with kstrtoull() 
 From: Chen Huang
> Sent: 26 May 2021 10:20
> 
> The simple_strtoull() function is deprecated in some situation, since
> it does not check for the range overflow, use kstrtoull() instead.
> 
...
> -     target_bytes = simple_strtoull(buf, &endchar, 0) * 1024;
> +     ret = kstrtoull(buf, 0, &target_bytes);
> +     if (ret)
> +             return ret;
> +     target_bytes *= 1024;
I'd have thought it was more important to check *endchar
than overflow.
If you are worried about overflow you need a range check
before the multiply.
        David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)
 |