From patchwork Fri Jun 26 13:05:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11627569 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2EF66913 for ; Fri, 26 Jun 2020 13:07:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D591E2080C for ; Fri, 26 Jun 2020 13:07:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gZyQ6WfB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UWsgLVFR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D591E2080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u83Ks2BGxpWKw7ELn+gZZd+2Z+esA/wBGRaU7ST9FzI=; b=gZyQ6WfByKb3Bp8qu2aWwvr0C y5bH+jWVMN6PkASYaSupTwn6Gn1dRDrHuuL1vkWVYRq5FQ9O5fcVYm4tdEHyizMBkSZo9sgjZK8WW jlt53fIHUmpw98bYBz1Kd4IEW184jkGPuZKb0+grTjv8lPj3Pa/X2z9C8gheQu39Qg+cef6zR5G9O kLfPIf3VgEWhl/vkjj4F8yjmxA2MslQzX9XgyNqmcw4AFwe02Ekd1pqyJZ5YHIBcgqKWIWUNeVaXY RlwltVpXKOWD4x0Dw+LfvIfGbl7vXK/TPZLk/Ys6rfNzdG5gHAbzlqeE/KR5/zftQvmKNeWDbkE+M H7GJB9Ufg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joo30-0002hI-P0; Fri, 26 Jun 2020 13:05:38 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joo2s-0002fx-Q1 for linux-arm-kernel@lists.infradead.org; Fri, 26 Jun 2020 13:05:31 +0000 Received: by mail-wm1-x342.google.com with SMTP id l17so8786626wmj.0 for ; Fri, 26 Jun 2020 06:05:30 -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=e1JE61jVdiQYepiV7xF2xc1YtlFIzd879Ys2h+y3NTv6LMZU8fVh5bx5qGT0tXENeG HILtf6fa2q7bUJRKr5r3wvL6rBFQeYvwv9g93/qiXtfp74+NCjHA/GynawyXxcGGVFa6 ZwAQv24SdHJmCMYBppkBCgL7LGHACzwtze/xwx8XKp64rx92F1cMfk3PoG50XvGXrp84 D1cQ5kxDJ4dZ+cAKeFwZBNwxzhH4oqH6uK1nSwtlk2Krgkvw2gtGQFJX6etxV+apDVe2 cvxGleW5qnSC0WHn81m7C0He6Ylg4anrJDeehJL4eQJY6QiDRGObs55Q5wOTnZs7ZlE/ MAuA== X-Gm-Message-State: AOAM530Se5xbHBTm5jRaLdbhlxPwWZZqAxiM4wQ6Gpkk5eThackhpn+S wJQECG4JfMZQLBXsl+5tlExnpQ== X-Google-Smtp-Source: ABdhPJyJ2n62/Y1Rl+W1QOIJetY7OS5+awAyZ6wQTR6lWI70ZzGrBOLFafJyKmyAFcSNekqG1/1E/g== 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 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 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Eurotech S.p.A" , Rodolfo Giometti , Lee Jones , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Acked-by: Rodolfo Giometti --- 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);