Skip to contentSkip to conversation

xen-blkback: enlarge the array size of blkback name

PATCH Superseded Tao Chen 3 participants 5 messages Mar 27, 2015

Subsystems (2)
lore
Share & tools
lore

Tao Chen

author
#0 lore raw

PATCH v2 1/1 xen-blkback: enlarge the array size of blkback name

The blkback name is like blkback.domid.xvd[a-z], if domid has four digits (means larger than 1000), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro to be 20, enlarge the array size of blkback name, so it will be fully shown in any case.

---
v2:
- Change the value of BLKBACK_NAME_LEN macro from (TASK_COMM_LEN * 2) to 20. Because 20 is already safe for the length of blkback name.

---
 drivers/block/xen-blkback/xenbus.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/block/xen-blkback/xenbus.c +5 -2
index e3afe97..b33083e 100644
@@ -21,6 +21,9 @@
 #include <xen/grant_table.h>
 #include "common.h"
 
+/* Enlarge the array size in order to fully show blkback name. */
+#define BLKBACK_NAME_LEN (20)
+
 struct backend_info {
 	struct xenbus_device	*dev;
 	struct xen_blkif	*blkif;
@@ -70,7 +73,7 @@ static int blkback_name(struct xen_blkif *blkif, char *buf)
 	else
 		devname  = devpath;
 
-	snprintf(buf, TASK_COMM_LEN, "blkback.%d.%s", blkif->domid, devname);
+	snprintf(buf, BLKBACK_NAME_LEN, "blkback.%d.%s", blkif->domid, devname);
 	kfree(devpath);
 
 	return 0;
@@ -79,7 +82,7 @@ static int blkback_name(struct xen_blkif *blkif, char *buf)
 static void xen_update_blkif_status(struct xen_blkif *blkif)
 {
 	int err;
-	char name[TASK_COMM_LEN];
+	char name[BLKBACK_NAME_LEN];
 
 	/* Not ready to connect? */
 	if (!blkif->irq || !blkif->vbd.bdev)
Signature · 1 line
1.8.5
Acked-by on v2 1/1
#1 lore raw

El 27/03/15 a les 14.15, Tao Chen ha escrit:

Quoted 7 lines

The blkback name is like blkback.domid.xvd[a-z], if domid has four digits (means larger than 1000), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro to be 20, enlarge the array size of blkback name, so it will be fully shown in any case.

#2 lore raw
Quoted 11 lines · Roger Pau Monné

El 27/03/15 a les 14.15, Tao Chen ha escrit:

Quoted 7 lines

The blkback name is like blkback.domid.xvd[a-z], if domid has four digits (means larger than 1000), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro to be 20, enlarge the array size of blkback name, so it will be fully shown in any case.

OK, applied.

#3 lore raw
In reply to Roger Pau Monné
Quoted 11 lines · Roger Pau Monné

El 27/03/15 a les 14.15, Tao Chen ha escrit:

Quoted 7 lines

The blkback name is like blkback.domid.xvd[a-z], if domid has four digits (means larger than 1000), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro to be 20, enlarge the array size of blkback name, so it will be fully shown in any case.

OK, applied.

Acked-by on v2 1/1
#4 lore raw
In reply to Tao Chen

El 27/03/15 a les 14.15, Tao Chen ha escrit:

Quoted 7 lines

The blkback name is like blkback.domid.xvd[a-z], if domid has four digits (means larger than 1000), then the backmost xvd wouldn't be fully shown.

Define a BLKBACK_NAME_LEN macro to be 20, enlarge the array size of blkback name, so it will be fully shown in any case.