[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB41577DBA5D2C981ACEC4D9DED40AA@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Sun, 14 Sep 2025 04:27:19 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Alok Tiwari <alok.a.tiwari@...cle.com>, "kys@...rosoft.com"
<kys@...rosoft.com>, "haiyangz@...rosoft.com" <haiyangz@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>, "decui@...rosoft.com"
<decui@...rosoft.com>, "linux-hyperv@...r.kernel.org"
<linux-hyperv@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/3] drivers: hv: vmbus: Fix sscanf format specifier in
target_cpu_store()
From: Alok Tiwari <alok.a.tiwari@...cle.com> Sent: Saturday, September 13, 2025 12:25 PM
>
> The target_cpu_store() function parses the target CPU from the sysfs
> buffer using sscanf(). The format string currently uses "%uu", which
> is invalid and causes incorrect parsing.
The %uu format string definitely looks invalid, but I'm not seeing
incorrect parsing. For example, this command works:
# echo 5 >/sys/bus/vmbus/devices/<uuid>/channels/<nn>/cpu
and the target cpu is indeed changed to "5". A two-digit value also
works:
# echo 14 >/sys/bus/vmbus/devices/<uuid>/channels/<nn>/cpu
What are the details of the incorrect parsing that you are seeing?
Michael
>
> Fix it by using "%u" to correctly read the value.
>
> This only fixes the parsing format.
>
> Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
> ---
> drivers/hv/vmbus_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 8b58306cb140..fbab9f2d7fa6 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -1742,7 +1742,7 @@ static ssize_t target_cpu_store(struct vmbus_channel
> *channel,
> u32 target_cpu;
> ssize_t ret;
>
> - if (sscanf(buf, "%uu", &target_cpu) != 1)
> + if (sscanf(buf, "%u", &target_cpu) != 1)
> return -EIO;
>
> cpus_read_lock();
> --
> 2.50.1
>
Powered by blists - more mailing lists