From 316a1bef0d1622410c9f0f301173d0a03168ce37 Mon Sep 17 00:00:00 2001 From: Ye Bin Date: Fri, 9 Oct 2020 16:05:52 +0800 Subject: 9p/xen: Fix format argument warning Fix follow warnings: [net/9p/trans_xen.c:454]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'. [net/9p/trans_xen.c:460]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'. Link: http://lkml.kernel.org/r/20201009080552.89918-1-yebin10@huawei.com Reported-by: Hulk Robot Signed-off-by: Ye Bin Signed-off-by: Dominique Martinet --- net/9p/trans_xen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index bc8807d9281f..f4fea28e05da 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -451,13 +451,13 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev, char str[16]; BUILD_BUG_ON(XEN_9PFS_NUM_RINGS > 9); - sprintf(str, "ring-ref%u", i); + sprintf(str, "ring-ref%d", i); ret = xenbus_printf(xbt, dev->nodename, str, "%d", priv->rings[i].ref); if (ret) goto error_xenbus; - sprintf(str, "event-channel-%u", i); + sprintf(str, "event-channel-%d", i); ret = xenbus_printf(xbt, dev->nodename, str, "%u", priv->rings[i].evtchn); if (ret) -- cgit v1.2.3 From 7ca1db21ef8e0e6725b4d25deed1ca196f7efb28 Mon Sep 17 00:00:00 2001 From: Anant Thazhemadam Date: Mon, 12 Oct 2020 09:54:04 +0530 Subject: net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid In p9_fd_create_unix, checking is performed to see if the addr (passed as an argument) is NULL or not. However, no check is performed to see if addr is a valid address, i.e., it doesn't entirely consist of only 0's. The initialization of sun_server.sun_path to be equal to this faulty addr value leads to an uninitialized variable, as detected by KMSAN. Checking for this (faulty addr) and returning a negative error number appropriately, resolves this issue. Link: http://lkml.kernel.org/r/20201012042404.2508-1-anant.thazhemadam@gmail.com Reported-by: syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com Tested-by: syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com Signed-off-by: Anant Thazhemadam Signed-off-by: Dominique Martinet --- net/9p/trans_fd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index c0762a302162..8f528e783a6c 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -1023,7 +1023,7 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) csocket = NULL; - if (addr == NULL) + if (!addr || !strlen(addr)) return -EINVAL; if (strlen(addr) >= UNIX_PATH_MAX) { -- cgit v1.2.3