From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752151AbbCMHxW (ORCPT ); Fri, 13 Mar 2015 03:53:22 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:21989 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751320AbbCMHxS (ORCPT ); Fri, 13 Mar 2015 03:53:18 -0400 From: Tao Chen To: , CC: , , , , Subject: [PATCH] xen-blkback: enlarge the array size of blkback name Date: Fri, 13 Mar 2015 15:52:21 +0000 Message-ID: <1426261941-32424-1-git-send-email-boby.chen@huawei.com> X-Mailer: git-send-email 1.8.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.101.253] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The blkback name is like blkback.domid.xvd[a-z], if domid has three digits (means larger than 100), then the backmost xvd wouldn't be fully shown. Define a BLKBACK_NAME_LEN macro which is (TASK_COMM_LEN * 2), enlarge the array size of blkback name, so it will be fully shown in any case. Signed-off-by: Tao Chen --- drivers/block/xen-blkback/xenbus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index e3afe97..0289e21 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -21,6 +21,9 @@ #include #include "common.h" +/* Enlarge the array size in order to fully show blkback name. */ +#define BLKBACK_NAME_LEN (TASK_COMM_LEN * 2) + 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) -- 1.8.5