Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp242154imm; Thu, 12 Jul 2018 18:27:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcTONwmmfh6iU0MwTGir/fwRO+XfFaDvldIYx0RBdlRsWyXFI9l0NHHxNRGKHhmAIUSXqZP X-Received: by 2002:a17:902:294a:: with SMTP id g68-v6mr4445972plb.58.1531445269896; Thu, 12 Jul 2018 18:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531445269; cv=none; d=google.com; s=arc-20160816; b=AMdjsoTN0vLz6aCj0qT2wR+/IO5851iWSZNehzw8JNB2NoF8wSdTZfiDD+EdvDZcRa xfOv6bccujafnMbDV5iQplbkIbggG/A/eKXmZK2eGOfjKfUzx9gGQ5FO0NLXXhIx/O+I h6KUDgKy19V7RqaaPaHtuxurYrhCvjDiAOaIqNQ+4uuMUVs1lFqmnfAE7fZ+OgNhuyem feszxPxMki/y4vHNA1QuVTzs6QisX+9mMiuOqDXBFpw+JTnwJAkBcI0tVOCwDlMnffhv bVaLoroJDoXKScaueXROBZxPh3Q6PWADcqmqzRdaay9Xm0lg72m3oZNUjD+iGGutSAhq rUvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:arc-authentication-results; bh=wuqYlGBMxtVS673hGdOgbHBkaWhOEo1jYao7OSmORZo=; b=OR4Qnfc62D5r2mbbYvJfihCupSA0a3Q3cwez22rKByPn3VyO1NotBr4h2WZ6HXVqiT HvNx1Q+KNp/rGtJrXVGM4ap7JoZuMbGMMh/0R/uRNNtx261tRfVxDlr8UmEv6tuGRPrk 3ZCFLLwoRy00TCna7+2RWLHvWq0ccv8q0+MfWPWyAwagby3Me4xvGLdUfI+gJ/v7O3Yg 1VF55lQQb6ZR2UhwZU8/ffwdRxAwrV82z9WPJ6aNXQ58hqehu5c2Kg3UCBLPiAaPDL8o lPoPSSItFimhIw3ukirRpXHRNfEISTq+PGqTnYSnIYZ2jtfe7QrBz1psKTyw4qxE4kAz +AXQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23-v6si22324525pgl.275.2018.07.12.18.27.35; Thu, 12 Jul 2018 18:27:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388130AbeGMBiK (ORCPT + 99 others); Thu, 12 Jul 2018 21:38:10 -0400 Received: from nautica.notk.org ([91.121.71.147]:43026 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387896AbeGMBiK (ORCPT ); Thu, 12 Jul 2018 21:38:10 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 3B3E8C028; Fri, 13 Jul 2018 03:25:57 +0200 (CEST) From: Dominique Martinet Cc: Dominique Martinet , Tyrel Datwyler , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/18] ibmvscsi: change strncpy+truncation to strlcpy Date: Fri, 13 Jul 2018 03:25:56 +0200 Message-Id: <1531445156-19690-1-git-send-email-asmadeus@codewreck.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> References: <1531444483-17338-1-git-send-email-asmadeus@codewreck.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Generated by scripts/coccinelle/misc/strncpy_truncation.cocci Signed-off-by: Dominique Martinet --- Please see https://marc.info/?l=linux-kernel&m=153144450722324&w=2 (the first patch of the serie) for the motivation behind this patch drivers/scsi/ibmvscsi/ibmvscsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 17df76f0be3c..79eb8af03a19 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -1274,14 +1274,12 @@ static void send_mad_capabilities(struct ibmvscsi_host_data *hostdata) if (hostdata->client_migrated) hostdata->caps.flags |= cpu_to_be32(CLIENT_MIGRATED); - strncpy(hostdata->caps.name, dev_name(&hostdata->host->shost_gendev), + strlcpy(hostdata->caps.name, dev_name(&hostdata->host->shost_gendev), sizeof(hostdata->caps.name)); - hostdata->caps.name[sizeof(hostdata->caps.name) - 1] = '\0'; location = of_get_property(of_node, "ibm,loc-code", NULL); location = location ? location : dev_name(hostdata->dev); - strncpy(hostdata->caps.loc, location, sizeof(hostdata->caps.loc)); - hostdata->caps.loc[sizeof(hostdata->caps.loc) - 1] = '\0'; + strlcpy(hostdata->caps.loc, location, sizeof(hostdata->caps.loc)); req->common.type = cpu_to_be32(VIOSRP_CAPABILITIES_TYPE); req->buffer = cpu_to_be64(hostdata->caps_addr); -- 2.17.1