From patchwork Wed Feb 3 06:50:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anil Gurumurthy X-Patchwork-Id: 8198711 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8CCCA9F37A for ; Wed, 3 Feb 2016 06:50:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A867D201ED for ; Wed, 3 Feb 2016 06:50:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDC79201F5 for ; Wed, 3 Feb 2016 06:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756495AbcBCGu2 (ORCPT ); Wed, 3 Feb 2016 01:50:28 -0500 Received: from mail-bl2on0120.outbound.protection.outlook.com ([65.55.169.120]:18152 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754995AbcBCGuZ convert rfc822-to-8bit (ORCPT ); Wed, 3 Feb 2016 01:50:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qlgc.onmicrosoft.com; s=selector1-qlogic-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mASjjMsACQbGt5Na9YiJ7k/AFfV7vkUljui3dpmZoJ4=; b=afS+3ZhMULzQw7YxYyakVOeYlcxmVk/5LBbY7b8KsPelDyJ+M4YKezHjjX11YegBfYFxN+4FFFqmulQZqzqwLt6Sq71tzGMRZKfP4vhLDf4V8hJjF+jbEbPWZHINw46TwL46o/C9OB6hTHhJ8Dv6Ns/P9Nbrzz5Y5+EUrAObLBc= Received: from CY1PR11MB0218.namprd11.prod.outlook.com (10.160.228.24) by BN3PR1101MB1140.namprd11.prod.outlook.com (10.165.75.142) with Microsoft SMTP Server (TLS) id 15.1.396.15; Wed, 3 Feb 2016 06:50:21 +0000 Received: from CY1PR11MB0218.namprd11.prod.outlook.com ([10.160.228.24]) by CY1PR11MB0218.namprd11.prod.outlook.com ([10.160.228.24]) with mapi id 15.01.0396.020; Wed, 3 Feb 2016 06:50:21 +0000 From: Anil Gurumurthy To: Dan Carpenter CC: Sudarsana Kalluru , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi , linux-kernel , "kernel-janitors@vger.kernel.org" Subject: RE: [patch] bfa: use strncpy() instead of memcpy() Thread-Topic: [patch] bfa: use strncpy() instead of memcpy() Thread-Index: AQHRW2uXuBgl9mK55EGwHR6j62xq6J8Z5jEg Date: Wed, 3 Feb 2016 06:50:21 +0000 Message-ID: References: <20160130143603.GB3462@mwanda> In-Reply-To: <20160130143603.GB3462@mwanda> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oracle.com; dkim=none (message not signed) header.d=none; oracle.com; dmarc=none action=none header.from=qlogic.com; x-originating-ip: [122.172.27.168] x-microsoft-exchange-diagnostics: 1; BN3PR1101MB1140; 5:+DX4wkurJgIYN23j7+iLzug5QGp0PsXe1CrD/0xieduqO1pQfYBlbmx9fj2bmttpz26uimJWI3/fExfLyzvwXlaaTidGLCEri1B6sSUIufbcBjttyf5hsFtMDd1Yg7eufL1S/j53LWzi/wigwqXvGw==; 24:App/CXyYL4KSvyI3bLBHteBa5l1lVRCjc3XAusdiylVDZFzBAqpd89ARItgD9cGQSet31pQAD77KbYMtMcQPtj6qANts60wHGS7OOJSRmq8=; 20:U2Txh5dqyCRGy5+J+xH6HiDKk5Q+cHmiCx1GuMpztKGZlYI8ed5c2k2DqW/6aotkS1lKKMmG0YLCReVP01g4RyVOMxBcgha3jtnliZKZnVIbxkVyuUI/xlOknnVZkchADz4rWYeMMQg0/cPcnCviA4ihR4Q3DF7hkegfK9azMhk= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR1101MB1140; x-ms-office365-filtering-correlation-id: 07ed8f88-65ab-4286-3b80-08d32c664946 x-ld-processed: 0d68a1f9-1490-4d0e-8767-a87dab3ef2ba,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:BN3PR1101MB1140; BCL:0; PCL:0; RULEID:; SRVR:BN3PR1101MB1140; x-forefront-prvs: 08417837C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(13464003)(76576001)(5002640100001)(99286002)(4326007)(19580405001)(19580395003)(106116001)(2900100001)(3280700002)(87936001)(2950100001)(5003600100002)(92566002)(11100500001)(5001960100002)(189998001)(77096005)(3660700001)(122556002)(110136002)(1220700001)(5004730100002)(1096002)(2906002)(74316001)(10400500002)(66066001)(3846002)(6116002)(102836003)(54356999)(76176999)(50986999)(33656002)(586003)(5008740100001)(40100003)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR1101MB1140; H:CY1PR11MB0218.namprd11.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: qlogic.com X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2016 06:50:21.3872 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0d68a1f9-1490-4d0e-8767-a87dab3ef2ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR1101MB1140 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Acked-by: Anil Gurumurthy -----Original Message----- From: Dan Carpenter [mailto:dan.carpenter@oracle.com] Sent: 30 January 2016 20:06 To: Anil Gurumurthy Cc: Sudarsana Kalluru ; James E.J. Bottomley ; Martin K. Petersen ; linux-scsi ; linux-kernel ; kernel-janitors@vger.kernel.org Subject: [patch] bfa: use strncpy() instead of memcpy() BFA_MFG_NAME is "QLogic" which is only 7 bytes, but we are copying 8 bytes. It's harmless because the badding byte is likely zero but it makes static checkers complain. Signed-off-by: Dan Carpenter --- Technically the memset() is not needed because strncpy() will pad the rest of the buffer with zeros but I was worried that people would be paranoid. the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 251e2ff..a1ada4a 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c @@ -2803,7 +2803,7 @@ void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer) { memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN); - memcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); + strncpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); } void -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in