Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp241667imm; Thu, 12 Jul 2018 18:27:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeCZvfcyaXL5eWTXKIvkyqfsl4z64jMLPhTB31qvRCBWdf/R0eqsJenfAX9h9NEWXPdOnv0 X-Received: by 2002:a65:448c:: with SMTP id l12-v6mr3991679pgq.277.1531445221389; Thu, 12 Jul 2018 18:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531445221; cv=none; d=google.com; s=arc-20160816; b=F7ae0kIDQsej0x1hN0Z3ZC6eIKe0/4ZCTLpeOUjhUMRmNfHHPNz1bDklaGo+f8NFwn bwiZVePuAFRtfZkVZP7Y+6Jz3MnMUmxbOpTlPjggvnUhaO68TTVF0ZC0EmDH293DgUmA RMks6/cP746HlQrpnM0gVIxe8Hq9zVYO2UzlMQpWqzauDzTA8C2mjbrm2ErQjO2d3gMZ usV/JBsZEU1Rlo8djDxAFjhQU056Mkeu0uRaDznAPMHniTIJIw3Q9gOFFN9eRwCh7z7E vn1y8NOdeDYiZkZN6t0CsOriEQUbO99QV9j66Tf2Yqx67VZ0m6vEnbPG6tSqOK62/WQ9 anmg== 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=BkKR6B556tMX7RlyXXm0bMJ4I7GMUW4JuH+nTt52Zb4=; b=IWEIBKYXKPP4UdQhK+unsfpaaP50bXwpteOUPvrwkP00lOQaGzBU9lWPnHesGVu2h8 0zpDBq4iV2fTJ01JE6PfkF7tvovNVpZ9wb+1MVRvx/xm25Gu4PFxYu7/zKzFoEAK//2H LhccH36INLfkbnxhT4fuS4PZ/LST1ikPNvYATQsi3RP7JWo4tEYApbfbJ3892ZNNfMEv NiQGvorLUArcBYAovKEBY0Wizfk8FyWVR8Ut/F5bs7NTr+mu3P+Htc1dA+7hHM4l0b/z /5g9h7u1+n1kqDXRT515V/O92lKhoPyZN7ersYV0b68DFx4Ajz2MeDkI+7ohC5FxkUGs oFEQ== 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 x3-v6si21464289pgo.542.2018.07.12.18.26.46; Thu, 12 Jul 2018 18:27:01 -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 S2388043AbeGMBh5 (ORCPT + 99 others); Thu, 12 Jul 2018 21:37:57 -0400 Received: from nautica.notk.org ([91.121.71.147]:43005 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387896AbeGMBh4 (ORCPT ); Thu, 12 Jul 2018 21:37:56 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 3F339C023; Fri, 13 Jul 2018 03:25:43 +0200 (CEST) From: Dominique Martinet Cc: Dominique Martinet , Chris Lee , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/18] myricom: change strncpy+truncation to strlcpy Date: Fri, 13 Jul 2018 03:25:41 +0200 Message-Id: <1531445141-19481-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/net/ethernet/myricom/myri10ge/myri10ge.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index b2d2ec8c11e2..f7178cdb6bd8 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -553,8 +553,7 @@ myri10ge_validate_firmware(struct myri10ge_priv *mgp, } /* save firmware version for ethtool */ - strncpy(mgp->fw_version, hdr->version, sizeof(mgp->fw_version)); - mgp->fw_version[sizeof(mgp->fw_version) - 1] = '\0'; + strlcpy(mgp->fw_version, hdr->version, sizeof(mgp->fw_version)); sscanf(mgp->fw_version, "%d.%d.%d", &mgp->fw_ver_major, &mgp->fw_ver_minor, &mgp->fw_ver_tiny); -- 2.17.1