[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH -next 2/3] xen: balloon: Replaced simple_strtoull() with kstrtoull()
The simple_strtoull() function is deprecated in some situation, since it does not check for the range overflow, use kstrtoull() instead. Signed-off-by: Chen Huang <chenhuang5@xxxxxxxxxx> --- drivers/xen/xen-balloon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c index a8d24433c8e9..1fba838963d2 100644 --- a/drivers/xen/xen-balloon.c +++ b/drivers/xen/xen-balloon.c @@ -163,13 +163,16 @@ static ssize_t store_target_kb(struct device *dev, const char *buf, size_t count) { - char *endchar; + ssize_t ret; unsigned long long target_bytes; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - target_bytes = simple_strtoull(buf, &endchar, 0) * 1024; + ret = kstrtoull(buf, 0, &target_bytes); + if (ret) + return ret; + target_bytes *= 1024; balloon_set_new_target(target_bytes >> PAGE_SHIFT); -- 2.25.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |