Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp552348ybt; Fri, 26 Jun 2020 06:06:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1ZPStTxI44nTevJG4rGiTSVA3e+ufY37gl0pnTGjkHuhM0dByWvr4qTxyrIsoi+Gw0ZaW X-Received: by 2002:a17:906:fa92:: with SMTP id lt18mr2607600ejb.423.1593176771955; Fri, 26 Jun 2020 06:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593176771; cv=none; d=google.com; s=arc-20160816; b=vFquEpJ6oEcbf85AfhPZIOnPBHqWBXigHqeuD54L2YUSAw8CyhzJPw6b0aNRvkK5LB 1qHoDprKtpZp1KPXeEXonKe0dZXVqn6ms5A7LPaHDyiiSeVn+VwWzaMsfV04LlQm/Y3F hGIwbMyzEODCW3OSRnB+ZklPTTBo7sabOfPkl1QSMybwPFfaq90tGa8pvf/mkFHMp8dc aTsk4MBuAVJ16c29ne4767uZjvIkewCmItZsrCmWEzK1rjl2fm5JRyjDc4zLfCVs/p3L hC6CSvI63mIxur7AgFSBY0Tt0atTelkKrkeplGaEO4oQNQRU8YhN/A7u7vNpm+MC3noq 0iKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6du7sHpmroejr9lp9ztEYkWIN/fkcg7/2Uksn80/5h0=; b=ecy3zPnBgS0AzxjrlVd7I/bDYwuV/nerQUxeOOIn4bDwnGqp2EOUB6bO9LkgiU8Ss5 8Cc+Au0plV25NPY0eAzJ2gMxNQKsvJNEBdHrwzQAPiVSRFWHduEZTl1OhgkI+XNKMPQr 7jlXO4KN4NJemslTK0+9az6D1CJpaRIc6uD0oa2boy5Cjtq2xT4spSRiBUv70dEJ/qby 6jUOxyuXmNbJNzw/1AUOEc21t8fXvOarXr6fcFvu5tuCAzzLrqA1KTYRvu61GPuCPm5y zRDy1A+88X8+/gO8iXEz5q5q9K7PP8AkNRBLMd6pJRecn4uk7CL5mXvZfyywFvrHDpRn 7X2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UWsgLVFR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lc19si5156277ejb.584.2020.06.26.06.05.44; Fri, 26 Jun 2020 06:06:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UWsgLVFR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727845AbgFZNFe (ORCPT + 99 others); Fri, 26 Jun 2020 09:05:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbgFZNFb (ORCPT ); Fri, 26 Jun 2020 09:05:31 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327F1C08C5DB for ; Fri, 26 Jun 2020 06:05:31 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id o8so8766743wmh.4 for ; Fri, 26 Jun 2020 06:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6du7sHpmroejr9lp9ztEYkWIN/fkcg7/2Uksn80/5h0=; b=UWsgLVFRaDNyhFO1xT+LBUyTFFSmoKYce1w5HR+oyOoZjlI2VIetRXHVv0ch5mYgXC IqCuj/qcmtBNc/qm+riwEb3JXaPnmf3WlzoUZxMse3tMkwOUl2f9F6hAwtFxCgQYlgQu /NBi05hfpZyzwTGRd5e3u6roLKEP5pr0sKjGU60X+9CJKWYbTeI6Y9Q6WHxwrUZTf4M6 PHIZTyaDKpc657YDC4rsn3THlGs6o2cnDeiLFGABbZTmcnQeu+a04Dov95pgGhnvLKor ba62ALADZf3j6AMz9l+Xu/vmcMB4Hui9d9pWDj1pw09ld0N6+M+hEN3RpR55JEF+iFnR B4zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6du7sHpmroejr9lp9ztEYkWIN/fkcg7/2Uksn80/5h0=; b=KZgXFA68eVDWkZpB2JZZUCB2Qtk3nBiSXK97EemB7XXKCnRDNXFh0dR7DE1pilTaSu Qo29FzlrTjFYjADAQhcrmiFgGwhvI0BkIBY4hVSV4ag3LiUuSPEXgWi1N4sNMMkdSODz hldV/kkKAFTwPdTKocx/kZb+Ys+YMxUENSznTIVKJiCMxNeNW5dCQBYvis3SB/0z4DLe 86XkC4k3h2FnjSrIk+k52mv29C17Atmin8kZgt/YO1FhpOIqERW41oD31kBmY2lDviyZ OW2/EW2Q4pEDnLrdbBn5D8hKGjVAMgosYnJaUiQtVI8qZlSpi/Kw//YncKFc6N1A6Ple 9SXw== X-Gm-Message-State: AOAM531inZXAhwOA/t837vT0REzasYHgkLQFEApeMd/ODDMNX17rGftw WiJ8xu2HfU4QwGhVwR+d4DGclQ== X-Received: by 2002:a05:600c:2254:: with SMTP id a20mr3238838wmm.115.1593176729872; Fri, 26 Jun 2020 06:05:29 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.144]) by smtp.gmail.com with ESMTPSA id u20sm16746904wmc.44.2020.06.26.06.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 06:05:29 -0700 (PDT) From: Lee Jones To: arnd@arndb.de, gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lee Jones , Rodolfo Giometti , "Eurotech S.p.A" Subject: [PATCH 01/10] misc: c2port: core: Ensure source size does not equal destination size in strncpy() Date: Fri, 26 Jun 2020 14:05:16 +0100 Message-Id: <20200626130525.389469-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200626130525.389469-1-lee.jones@linaro.org> References: <20200626130525.389469-1-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to ensure there's a place for the NULL terminator. Fixes the following W=1 warning(s): In file included from include/linux/bitmap.h:9, from include/linux/nodemask.h:95, from include/linux/mmzone.h:17, from include/linux/gfp.h:6, from include/linux/umh.h:4, from include/linux/kmod.h:9, from include/linux/module.h:16, from drivers/misc/c2port/core.c:9: In function ‘strncpy’, inlined from ‘c2port_device_register’ at drivers/misc/c2port/core.c:926:2: include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] 297 | #define __underlying_strncpy __builtin_strncpy | ^ include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’ 307 | return __underlying_strncpy(p, q, size); | ^~~~~~~~~~~~~~~~~~~~ Cc: Rodolfo Giometti Cc: "Eurotech S.p.A" Signed-off-by: Lee Jones --- drivers/misc/c2port/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c index 33bba18022892..80d87e8a0bea9 100644 --- a/drivers/misc/c2port/core.c +++ b/drivers/misc/c2port/core.c @@ -923,7 +923,7 @@ struct c2port_device *c2port_device_register(char *name, } dev_set_drvdata(c2dev->dev, c2dev); - strncpy(c2dev->name, name, C2PORT_NAME_LEN); + strncpy(c2dev->name, name, C2PORT_NAME_LEN - 1); c2dev->ops = ops; mutex_init(&c2dev->mutex); -- 2.25.1