Received: by 10.223.164.221 with SMTP id h29csp234284wrb; Fri, 3 Nov 2017 08:17:41 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QgsRgOMK/F0j1navxRrNTv8WLMZg8Fu4ZhktbkQf7vQ9jq8DFbiBF1tVkDVfRPibIGg0GM X-Received: by 10.99.139.195 with SMTP id j186mr7447829pge.231.1509722261786; Fri, 03 Nov 2017 08:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509722261; cv=none; d=google.com; s=arc-20160816; b=ZaX1eB78fDUxdTuxwbR/ODgFy5tbKneH7U6DlMZG+reuFofLyoHExP6quJu9x08j5v ye7Jc8Nb4ZtAMrvmOwDXdVzXrqjWh9VQ+nDgVNfgOUk2ldcxSNwcuHU2crjzq+IrNabw eKUuqPsVbPqhFbWT+PGinbXMqgR/f2aqbtyzppZdAjU84OMXia/h2NyMkyuX+DPKaGqc YTpFP1y+P8HfJKU9BkB1IoNTkCen41og4/aBjC0yg/OeqXy1+VBczL5Dmo0QoiHH5+bC lULi7l/i4Ulf7Jyc7qNuYPcugumvnhO7Cotcu0Ol1Yn9s1ye/cXCfaxNJZa+iqB01bHs tiLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=rLY8gyXX4Kb+WeAReXK/vBvyW6DyBrBUovmvDoUfB6U=; b=hW4m6CYM8mwAbzQBk35c2xkXWrvn/F/6/ul/dQkcKelvbdmKD8EoOptWhq/Wc0jIgk D+BcLtSIiqhLm0GG+zLDmKTLjQfzgSeSI/3m2GWWHnuV6rgzdlSIrEjEEChQwAPgt2n/ 5oDzSU9qJu7e2LGMc0Cx325FgMVTxl2zybpq/J3Gjl3A5FC8/1t/a8RlO0qa8GXbUhzH YPbvjnG9+7+onb8j0TzgFVqKf7MNTp3LVetszPCVtrxUjo/AoKiShBkFgfLjDJhl/kyS mITgAO2V2q/+BPbMB2mcXuTHOTrkCz461swqVOYcQ79PWYZf1GG2AJqXrr0bI1NNpGx9 AqHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Boi7onrz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si5270495plp.715.2017.11.03.08.17.20; Fri, 03 Nov 2017 08:17:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Boi7onrz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753361AbdKCPQ1 (ORCPT + 95 others); Fri, 3 Nov 2017 11:16:27 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:52735 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751303AbdKCPQY (ORCPT ); Fri, 3 Nov 2017 11:16:24 -0400 Received: by mail-pf0-f193.google.com with SMTP id e64so2404514pfk.9; Fri, 03 Nov 2017 08:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rLY8gyXX4Kb+WeAReXK/vBvyW6DyBrBUovmvDoUfB6U=; b=Boi7onrzdA/DESgUUu2kNIGUHhVj4lKpIA4gC/eTSpWGEBpJSRnr1apV+08/M5l7En n/T3OA0i8/uhjkqYFh9fFgsOic6e1qDMJLVk3qdmvc5yEpHkSHXDygsfm5lYgcu5auSy lt61CK6tDtYq23nbNOO0+k6fSwgT9rD/69mcqebNPnTeDtApBBx82sBA/p12QI8BbH1S QHjBkqGcPo/eRo2Izq9bFuang+p6n2z/nIamKRGEJ/T6uTImEavgCvPwCzcx91QrDDyg IAymbBF+p/ORQ9R9DdiMS8YI5MLSkaJ4aYdeE3MfmivCwsSCmnTIDxfSBjrMmF/v0bh9 /i+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rLY8gyXX4Kb+WeAReXK/vBvyW6DyBrBUovmvDoUfB6U=; b=JI/6swUeq7JsrPZzJkVn0dJfMBLVoeJ67jCp0yarS1AvNqEIjh9U9kzx4Oo4NlZcFD TdYfTkanvpCceMn+4di2OjTiAOEniV3OSu3E7aK2h5Fr/1FyE3V3M5bjWLoSmKCfpSYI G7/gzdO98Qqjqe5BD/reQYfgJLyhOKti2xx+MXH7fSsTU4mpjSmLCW14xZTQwvplNCAN leL2cHMHsFUi4ImGLPoCsW3M+/JARL4JQdaYyMXh9KjEs4Va2EvOxIOjvz8JWZDGIfG+ 3FBpr0CU+mHV2S428k7SveTi0kXQmj4bWf3Y7TBLJ2m19tWbvorHatlM3o1DSO1zM9ew pWqA== X-Gm-Message-State: AMCzsaWkX1caZFr6KQyciVpIhwplVmuYy7LRXuECPyhhHlqFgnGl3J9U hERqJjMte511hGY7pEYOAal06w== X-Received: by 10.99.65.131 with SMTP id o125mr7269956pga.83.1509722184237; Fri, 03 Nov 2017 08:16:24 -0700 (PDT) Received: from himanshu-Vostro-3559 ([103.46.195.161]) by smtp.gmail.com with ESMTPSA id a4sm11347069pfj.72.2017.11.03.08.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Nov 2017 08:16:22 -0700 (PDT) Date: Fri, 3 Nov 2017 20:46:14 +0530 From: Himanshu Jha To: jejb@linux.vnet.ibm.com Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, subbu.seetharaman@broadcom.com, ketan.mukadam@broadcom.com, jitendra.bhivare@broadcom.com Subject: Re: [PATCH v2] scsi: be2iscsi: Use kasprintf Message-ID: <20171103151613.GA2601@himanshu-Vostro-3559> References: <1507736174-13089-1-git-send-email-himanshujha199640@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507736174-13089-1-git-send-email-himanshujha199640@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 11, 2017 at 09:06:14PM +0530, Himanshu Jha wrote: Hi James, Just a reminder, is my patch in our queue ? Thanks Himanshu Jha > Use kasprintf instead of combination of kmalloc and sprintf. > Also, remove BEISCSI_MSI_NAME macro used to specify size of string as > kasprintf handles size computations. > > Signed-off-by: Himanshu Jha > --- > v2: > -remove the unnecessary macro BEISCSI_MSI_NAME. > > drivers/scsi/be2iscsi/be_main.c | 12 +++++------- > drivers/scsi/be2iscsi/be_main.h | 2 -- > 2 files changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c > index b4542e7..6a9ee0e 100644 > --- a/drivers/scsi/be2iscsi/be_main.c > +++ b/drivers/scsi/be2iscsi/be_main.c > @@ -803,15 +803,14 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) > > if (pcidev->msix_enabled) { > for (i = 0; i < phba->num_cpus; i++) { > - phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, > - GFP_KERNEL); > + phba->msi_name[i] = kasprintf(GFP_KERNEL, > + "beiscsi_%02x_%02x", > + phba->shost->host_no, i); > if (!phba->msi_name[i]) { > ret = -ENOMEM; > goto free_msix_irqs; > } > > - sprintf(phba->msi_name[i], "beiscsi_%02x_%02x", > - phba->shost->host_no, i); > ret = request_irq(pci_irq_vector(pcidev, i), > be_isr_msix, 0, phba->msi_name[i], > &phwi_context->be_eq[i]); > @@ -824,13 +823,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) > goto free_msix_irqs; > } > } > - phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, GFP_KERNEL); > + phba->msi_name[i] = kasprintf(GFP_KERNEL, "beiscsi_mcc_%02x", > + phba->shost->host_no); > if (!phba->msi_name[i]) { > ret = -ENOMEM; > goto free_msix_irqs; > } > - sprintf(phba->msi_name[i], "beiscsi_mcc_%02x", > - phba->shost->host_no); > ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc, 0, > phba->msi_name[i], &phwi_context->be_eq[i]); > if (ret) { > diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h > index 81ce3ff..8166de5 100644 > --- a/drivers/scsi/be2iscsi/be_main.h > +++ b/drivers/scsi/be2iscsi/be_main.h > @@ -155,8 +155,6 @@ > #define PAGES_REQUIRED(x) \ > ((x < PAGE_SIZE) ? 1 : ((x + PAGE_SIZE - 1) / PAGE_SIZE)) > > -#define BEISCSI_MSI_NAME 20 /* size of msi_name string */ > - > #define MEM_DESCR_OFFSET 8 > #define BEISCSI_DEFQ_HDR 1 > #define BEISCSI_DEFQ_DATA 0 > -- > 2.7.4 > From 1580985385924668791@xxx Wed Oct 11 18:05:57 +0000 2017 X-GM-THRID: 1580535731693778150 X-Gmail-Labels: Inbox,Category Forums