Skip to contentSkip to conversation

virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings

PATCH Superseded Zhu Yanjun 5 participants 7 messages Dec 27, 2023 – Jan 4, 2024

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Zhu Yanjun

author
#0 lore raw

PATCH v2 1/1 virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings

From: Zhu Yanjun <[email protected]>

Fix the warnings when building virtio_net driver.

"
drivers/net/virtio_net.c: In function ‘init_vqs’:
drivers/net/virtio_net.c:4551:48: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:
drivers/net/virtio_net.c:4551:41: note: directive argument in the range [-2147483643, 65534]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~
drivers/net/virtio_net.c:4551:17: note: ‘sprintf’ output between 8 and 18 bytes into a destination of size 16

 4551 |                 sprintf(vi->rq[i].name, "input.%d", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/net/virtio_net.c: In function ‘init_vqs’:
drivers/net/virtio_net.c:4552:49: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:
drivers/net/virtio_net.c:4552:41: note: directive argument in the range [-2147483643, 65534]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~~~~~~~~~~
drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and 19 bytes into a destination of size 16
4552 | sprintf(vi->sq[i].name, "output.%d", i);

"

---
 drivers/net/virtio_net.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
index d16f592c2061..89a15cc81396 100644
@@ -4096,10 +4096,11 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
 {
 	vq_callback_t **callbacks;
 	struct virtqueue **vqs;
-	int ret = -ENOMEM;
-	int i, total_vqs;
 	const char **names;
+	int ret = -ENOMEM;
+	int total_vqs;
 	bool *ctx;
+	u16 i;
 
 	/* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by
 	 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
@@ -4136,8 +4137,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
 	for (i = 0; i < vi->max_queue_pairs; i++) {
 		callbacks[rxq2vq(i)] = skb_recv_done;
 		callbacks[txq2vq(i)] = skb_xmit_done;
-		sprintf(vi->rq[i].name, "input.%d", i);
-		sprintf(vi->sq[i].name, "output.%d", i);
+		sprintf(vi->rq[i].name, "input.%u", i);
+		sprintf(vi->sq[i].name, "output.%u", i);
 		names[rxq2vq(i)] = vi->rq[i].name;
 		names[txq2vq(i)] = vi->sq[i].name;
 		if (ctx)
Signature · 1 line
2.27.0
#1 lore raw
Quoted 29 lines · Zhu Yanjun

From: Zhu Yanjun <[email protected]>

Fix the warnings when building virtio_net driver.

"
drivers/net/virtio_net.c: In function ‘init_vqs’:
drivers/net/virtio_net.c:4551:48: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:
drivers/net/virtio_net.c:4551:41: note: directive argument in the range [-2147483643, 65534]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~
drivers/net/virtio_net.c:4551:17: note: ‘sprintf’ output between 8 and 18 bytes into a destination of size 16

  4551 |                 sprintf(vi->rq[i].name, "input.%d", i);
       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/net/virtio_net.c: In function ‘init_vqs’:
drivers/net/virtio_net.c:4552:49: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:
drivers/net/virtio_net.c:4552:41: note: directive argument in the range [-2147483643, 65534]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~~~~~~~~~~
drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and 19 bytes into a destination of size 16
4552 | sprintf(vi->sq[i].name, "output.%d", i);

Quoted 1 line

"

Hi, all

V1->V2: Add commit logs. Format string is changed.

Best Regards,

Zhu Yanjun

Quoted 35 lines
---
  drivers/net/virtio_net.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
index d16f592c2061..89a15cc81396 100644
@@ -4096,10 +4096,11 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
  {
  	vq_callback_t **callbacks;
  	struct virtqueue **vqs;
-	int ret = -ENOMEM;
-	int i, total_vqs;
  	const char **names;
+	int ret = -ENOMEM;
+	int total_vqs;
  	bool *ctx;
+	u16 i;
 
  	/* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by
  	 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
@@ -4136,8 +4137,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
  	for (i = 0; i < vi->max_queue_pairs; i++) {
  		callbacks[rxq2vq(i)] = skb_recv_done;
  		callbacks[txq2vq(i)] = skb_xmit_done;
-		sprintf(vi->rq[i].name, "input.%d", i);
-		sprintf(vi->sq[i].name, "output.%d", i);
+		sprintf(vi->rq[i].name, "input.%u", i);
+		sprintf(vi->sq[i].name, "output.%u", i);
  		names[rxq2vq(i)] = vi->rq[i].name;
  		names[txq2vq(i)] = vi->sq[i].name;
  		if (ctx)
reviewer
#2 lore raw
Quoted 33 lines · Zhu Yanjun
Quoted 29 lines · Zhu Yanjun

From: Zhu Yanjun <[email protected]>

Fix the warnings when building virtio_net driver.

"
drivers/net/virtio_net.c: In function ‘init_vqs’:
drivers/net/virtio_net.c:4551:48: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:
drivers/net/virtio_net.c:4551:41: note: directive argument in the range [-2147483643, 65534]
4551 | sprintf(vi->rq[i].name, "input.%d", i);
| ^~~~~~~~~~
drivers/net/virtio_net.c:4551:17: note: ‘sprintf’ output between 8 and 18 bytes into a destination of size 16

  4551 |                 sprintf(vi->rq[i].name, "input.%d", i);
       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/net/virtio_net.c: In function ‘init_vqs’:
drivers/net/virtio_net.c:4552:49: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 9 [-Wformat-overflow=]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~
In function ‘virtnet_find_vqs’,
inlined from ‘init_vqs’ at drivers/net/virtio_net.c:4645:8:
drivers/net/virtio_net.c:4552:41: note: directive argument in the range [-2147483643, 65534]
4552 | sprintf(vi->sq[i].name, "output.%d", i);
| ^~~~~~~~~~~
drivers/net/virtio_net.c:4552:17: note: ‘sprintf’ output between 9 and 19 bytes into a destination of size 16
4552 | sprintf(vi->sq[i].name, "output.%d", i);

Quoted 1 line

"

Quoted 11 lines

Hi, all

V1->V2: Add commit logs. Format string is changed.

Best Regards,

Zhu Yanjun

Quoted 3 lines

---

You can put the changes log after "---" inside the patch.

Thanks.

Quoted 32 lines
Quoted 32 lines
  drivers/net/virtio_net.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +5 -4
index d16f592c2061..89a15cc81396 100644
@@ -4096,10 +4096,11 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
  {
  	vq_callback_t **callbacks;
  	struct virtqueue **vqs;
-	int ret = -ENOMEM;
-	int i, total_vqs;
  	const char **names;
+	int ret = -ENOMEM;
+	int total_vqs;
  	bool *ctx;
+	u16 i;
 
  	/* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by
  	 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
@@ -4136,8 +4137,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
  	for (i = 0; i < vi->max_queue_pairs; i++) {
  		callbacks[rxq2vq(i)] = skb_recv_done;
  		callbacks[txq2vq(i)] = skb_xmit_done;
-		sprintf(vi->rq[i].name, "input.%d", i);
-		sprintf(vi->sq[i].name, "output.%d", i);
+		sprintf(vi->rq[i].name, "input.%u", i);
+		sprintf(vi->sq[i].name, "output.%u", i);
  		names[rxq2vq(i)] = vi->rq[i].name;
  		names[txq2vq(i)] = vi->sq[i].name;
  		if (ctx)
#3 lore raw
In reply to Zhu Yanjun
kernel test robot noticed the following build warnings:

Hi Zhu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mst-vhost/linux-next]
[also build test WARNING on linus/master v6.7-rc7 next-20231222] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Zhu-Yanjun/virtio_net-Fix-d-directive-writing-between-1-and-11-bytes-into-a-region-of-size-10-warnings/20231227-223431
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:    https://lore.kernel.org/r/20231227142637.2479149-1-yanjun.zhu%40intel.com
patch subject: [PATCH v2 1/1] virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings
config: x86_64-randconfig-015-20231228 (https://download.01.org/0day-ci/archive/20231228/[email protected]/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231228/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/net/virtio_net.c: In function 'init_vqs':
drivers/net/virtio_net.c:4140:36: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]

      sprintf(vi->rq[i].name, "input.%u", i);
                                       ^
   drivers/net/virtio_net.c:4140:3: note: 'sprintf' output between 8 and 17 bytes into a destination of size 16
      sprintf(vi->rq[i].name, "input.%u", i);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/virtio_net.c:4141:35: warning: '%u' directive writing between 1 and 10 bytes into a region of size 9 [-Wformat-overflow=]
      sprintf(vi->sq[i].name, "output.%u", i);
                                      ^~
   drivers/net/virtio_net.c:4141:27: note: directive argument in the range [0, 2147483647]
      sprintf(vi->sq[i].name, "output.%u", i);
                              ^~~~~~~~~~~
   drivers/net/virtio_net.c:4141:3: note: 'sprintf' output between 9 and 18 bytes into a destination of size 16
      sprintf(vi->sq[i].name, "output.%u", i);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for DRM_I915_DEBUG_GEM
Depends on [n]: HAS_IOMEM [=y] && DRM_I915 [=m] && EXPERT [=y] && DRM_I915_WERROR [=n] Selected by [m]:
- DRM_I915_DEBUG [=y] && HAS_IOMEM [=y] && DRM_I915 [=m] && EXPERT [=y] && !COMPILE_TEST [=n]

vim +4141 drivers/net/virtio_net.c

4094
4095 static int virtnet_find_vqs(struct virtnet_info *vi)
4096 {
4097 vq_callback_t **callbacks;
4098 struct virtqueue **vqs;
4099 const char **names;
4100 int ret = -ENOMEM;
4101 int total_vqs;
4102 bool *ctx;
4103 u16 i;
4104
4105 /* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by
4106 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
4107 * possible control vq.
4108 */
4109 total_vqs = vi->max_queue_pairs * 2 +
4110 virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ);
4111
4112 /* Allocate space for find_vqs parameters */
4113 vqs = kcalloc(total_vqs, sizeof(*vqs), GFP_KERNEL);
4114 if (!vqs)
4115 goto err_vq;
4116 callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL);
4117 if (!callbacks)
4118 goto err_callback;
4119 names = kmalloc_array(total_vqs, sizeof(*names), GFP_KERNEL);
4120 if (!names)
4121 goto err_names;
4122 if (!vi->big_packets || vi->mergeable_rx_bufs) {
4123 ctx = kcalloc(total_vqs, sizeof(*ctx), GFP_KERNEL);
4124 if (!ctx)
4125 goto err_ctx;
4126 } else {
4127 ctx = NULL;
4128 }
4129
4130 /* Parameters for control virtqueue, if any */
4131 if (vi->has_cvq) {
4132 callbacks[total_vqs - 1] = NULL;
4133 names[total_vqs - 1] = "control";
4134 }
4135
4136 /* Allocate/initialize parameters for send/receive virtqueues */
4137 for (i = 0; i < vi->max_queue_pairs; i++) {
4138 callbacks[rxq2vq(i)] = skb_recv_done;
4139 callbacks[txq2vq(i)] = skb_xmit_done;
4140 sprintf(vi->rq[i].name, "input.%u", i);

> 4141			sprintf(vi->sq[i].name, "output.%u", i);

4142 names[rxq2vq(i)] = vi->rq[i].name;
4143 names[txq2vq(i)] = vi->sq[i].name;
4144 if (ctx)
4145 ctx[rxq2vq(i)] = true;
4146 }
4147
4148 ret = virtio_find_vqs_ctx(vi->vdev, total_vqs, vqs, callbacks,
4149 names, ctx, NULL);
4150 if (ret)
4151 goto err_find;
4152
4153 if (vi->has_cvq) {
4154 vi->cvq = vqs[total_vqs - 1];
4155 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
4156 vi->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
4157 }
4158
4159 for (i = 0; i < vi->max_queue_pairs; i++) {
4160 vi->rq[i].vq = vqs[rxq2vq(i)];
4161 vi->rq[i].min_buf_len = mergeable_min_buf_len(vi, vi->rq[i].vq);
4162 vi->sq[i].vq = vqs[txq2vq(i)];
4163 }
4164
4165 /* run here: ret == 0. */
4166
4167
4168 err_find:
4169 kfree(ctx);
4170 err_ctx:
4171 kfree(names);
4172 err_names:
4173 kfree(callbacks);
4174 err_callback:
4175 kfree(vqs);
4176 err_vq:
4177 return ret;
4178 }
4179

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw

Hi, lkp

I can reproduce this problem in my local host.

It seems that this problem is related with gcc-7. In the same test environment, with gcc-7, this problem will occur. With gcc later than version 9, this problem will not occur.

And with u16, the range of %u should be [0, 65535]. Not the following:
"
drivers/net/virtio_net.c:4141:27: note: directive argument in the range [0, 2147483647]

      sprintf(vi->sq[i].name, "output.%u", i);

"

And the size of name is 16. That is, the name string can contain 15 bytes characters.
When the variable i is set to the maximum 65535, the string should be "output.65535". The size of the string is 12 + 1 = 13 bytes. The size of the name is greater than the maximum string "output.65535".

In short, from the above, this problem results from gcc-7. It is a problem with gcc-7. Based on my tests with gcc-9, gcc-13, this problem is fixed in later gcc versions. And the warning is a false warning to this commit.

Best Regards
Zhu Yanjun

-----Original Message-----
From: lkp <[email protected]>
Sent: Thursday, December 28, 2023 9:49 PM
To: Zhu, Yanjun <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v2 1/1] virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings

Hi Zhu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mst-vhost/linux-next] [also build test WARNING on linus/master v6.7-rc7 next-20231222] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Zhu-Yanjun/virtio_net-Fix-d-directive-writing-between-1-and-11-bytes-into-a-region-of-size-10-warnings/20231227-223431
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link:    https://lore.kernel.org/r/20231227142637.2479149-1-yanjun.zhu%40intel.com
patch subject: [PATCH v2 1/1] virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings
config: x86_64-randconfig-015-20231228 (https://download.01.org/0day-ci/archive/20231228/[email protected]/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231228/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Closes: 
| https://lore.kernel.org/oe-kbuild-all/202312282156.wb5beuAb-lkp@intel.
| com/

All warnings (new ones prefixed by >>):

drivers/net/virtio_net.c: In function 'init_vqs':
drivers/net/virtio_net.c:4140:36: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]

      sprintf(vi->rq[i].name, "input.%u", i);
                                       ^
   drivers/net/virtio_net.c:4140:3: note: 'sprintf' output between 8 and 17 bytes into a destination of size 16
      sprintf(vi->rq[i].name, "input.%u", i);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 2 lines
Quoted 2 lines

drivers/net/virtio_net.c:4141:35: warning: '%u' directive writing between 1 and 10 bytes into a region of size 9 [-Wformat-overflow=]

      sprintf(vi->sq[i].name, "output.%u", i);
                                      ^~
   drivers/net/virtio_net.c:4141:27: note: directive argument in the range [0, 2147483647]
      sprintf(vi->sq[i].name, "output.%u", i);
                              ^~~~~~~~~~~
   drivers/net/virtio_net.c:4141:3: note: 'sprintf' output between 9 and 18 bytes into a destination of size 16
      sprintf(vi->sq[i].name, "output.%u", i);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for DRM_I915_DEBUG_GEM
Depends on [n]: HAS_IOMEM [=y] && DRM_I915 [=m] && EXPERT [=y] && DRM_I915_WERROR [=n] Selected by [m]:
- DRM_I915_DEBUG [=y] && HAS_IOMEM [=y] && DRM_I915 [=m] && EXPERT [=y] && !COMPILE_TEST [=n]

vim +4141 drivers/net/virtio_net.c

4094
4095 static int virtnet_find_vqs(struct virtnet_info *vi)
4096 {
4097 vq_callback_t **callbacks;
4098 struct virtqueue **vqs;
4099 const char **names;
4100 int ret = -ENOMEM;
4101 int total_vqs;
4102 bool *ctx;
4103 u16 i;
4104
4105 /* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by
4106 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
4107 * possible control vq.
4108 */
4109 total_vqs = vi->max_queue_pairs * 2 +
4110 virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ);
4111
4112 /* Allocate space for find_vqs parameters */
4113 vqs = kcalloc(total_vqs, sizeof(*vqs), GFP_KERNEL);
4114 if (!vqs)
4115 goto err_vq;
4116 callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL);
4117 if (!callbacks)
4118 goto err_callback;
4119 names = kmalloc_array(total_vqs, sizeof(*names), GFP_KERNEL);
4120 if (!names)
4121 goto err_names;
4122 if (!vi->big_packets || vi->mergeable_rx_bufs) {
4123 ctx = kcalloc(total_vqs, sizeof(*ctx), GFP_KERNEL);
4124 if (!ctx)
4125 goto err_ctx;
4126 } else {
4127 ctx = NULL;
4128 }
4129
4130 /* Parameters for control virtqueue, if any */
4131 if (vi->has_cvq) {
4132 callbacks[total_vqs - 1] = NULL;
4133 names[total_vqs - 1] = "control";
4134 }
4135
4136 /* Allocate/initialize parameters for send/receive virtqueues */
4137 for (i = 0; i < vi->max_queue_pairs; i++) {
4138 callbacks[rxq2vq(i)] = skb_recv_done;
4139 callbacks[txq2vq(i)] = skb_xmit_done;
4140 sprintf(vi->rq[i].name, "input.%u", i);

Quoted 1 line

4141 sprintf(vi->sq[i].name, "output.%u", i);

4142 names[rxq2vq(i)] = vi->rq[i].name;
4143 names[txq2vq(i)] = vi->sq[i].name;
4144 if (ctx)
4145 ctx[rxq2vq(i)] = true;
4146 }
4147
4148 ret = virtio_find_vqs_ctx(vi->vdev, total_vqs, vqs, callbacks,
4149 names, ctx, NULL);
4150 if (ret)
4151 goto err_find;
4152
4153 if (vi->has_cvq) {
4154 vi->cvq = vqs[total_vqs - 1];
4155 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
4156 vi->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
4157 }
4158
4159 for (i = 0; i < vi->max_queue_pairs; i++) {
4160 vi->rq[i].vq = vqs[rxq2vq(i)];
4161 vi->rq[i].min_buf_len = mergeable_min_buf_len(vi, vi->rq[i].vq);
4162 vi->sq[i].vq = vqs[txq2vq(i)];
4163 }
4164
4165 /* run here: ret == 0. */
4166
4167
4168 err_find:
4169 kfree(ctx);
4170 err_ctx:
4171 kfree(names);
4172 err_names:
4173 kfree(callbacks);
4174 err_callback:
4175 kfree(vqs);
4176 err_vq:
4177 return ret;
4178 }
4179

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

maintainer
#5 lore raw
In reply to Zhu Yanjun
Quoted 3 lines · On Wed, 27 Dec 2023 22:26:37 +0800 Zhu Yanjun wrote:

From: Zhu Yanjun <[email protected]>

Fix the warnings when building virtio_net driver.

This got marked as Not Applicable in patchwork, not sure why. Could you repost?

#6 lore raw
Quoted 6 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 27 Dec 2023 22:26:37 +0800 Zhu Yanjun wrote:

From: Zhu Yanjun <[email protected]>

Fix the warnings when building virtio_net driver.

This got marked as Not Applicable in patchwork, not sure why. Could you repost?

Got it. I will resend this commit very soon.

Best Regards,

Zhu Yanjun