From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBA91C2D0E8 for ; Thu, 26 Mar 2020 23:29:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9811F20838 for ; Thu, 26 Mar 2020 23:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585265359; bh=HDOf5iL2WzIZq9OFWuzWL8Xs5UhCelii0BSjOQdYEbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Rf3mbr0zP2QZDsEnrQ3F0e4dvq40whf+33BAzc1u4udztBGL4U4yuX3awjk4p+HGr VZ2/UMzkUP/rhf2y5oLOT7hPAOWFFO4w2sLl3qCHnr4vOsK0jTwyWlthVXrGI9EfUU uyGXw93sRWwlMPX0nnFHRok1xxht3YmJLtzqyx9Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727907AbgCZX3N (ORCPT ); Thu, 26 Mar 2020 19:29:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:43846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727830AbgCZXYT (ORCPT ); Thu, 26 Mar 2020 19:24:19 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D68A20719; Thu, 26 Mar 2020 23:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585265058; bh=HDOf5iL2WzIZq9OFWuzWL8Xs5UhCelii0BSjOQdYEbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RvWpNSpSo8oqr2V+UYHSTkMOysEofKvFcZpsxFvz+hRo7Cd9J7A7jceUbEpEHMh5v pQ0ybfOQe8k9z3Pu3//j9ILxreS1Fo1WCIFUhRNYyTB5awGDcTOJO0HBLN89+nAuBp KbHEr2s+x13ELSb0prcpc1KNOS3OIX43sRCANNjQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Len Brown , Sasha Levin , linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 18/28] tools/power turbostat: Fix gcc build warnings Date: Thu, 26 Mar 2020 19:23:47 -0400 Message-Id: <20200326232357.7516-18-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326232357.7516-1-sashal@kernel.org> References: <20200326232357.7516-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Len Brown [ Upstream commit d8d005ba6afa502ca37ced5782f672c4d2fc1515 ] Warning: ‘__builtin_strncpy’ specified bound 20 equals destination size [-Wstringop-truncation] reduce param to strncpy, to guarantee that a null byte is always copied into destination buffer. Signed-off-by: Len Brown Signed-off-by: Sasha Levin --- tools/power/x86/turbostat/turbostat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 5d0fddda842c4..78507cd479bb4 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -5323,9 +5323,9 @@ int add_counter(unsigned int msr_num, char *path, char *name, } msrp->msr_num = msr_num; - strncpy(msrp->name, name, NAME_BYTES); + strncpy(msrp->name, name, NAME_BYTES - 1); if (path) - strncpy(msrp->path, path, PATH_BYTES); + strncpy(msrp->path, path, PATH_BYTES - 1); msrp->width = width; msrp->type = type; msrp->format = format; -- 2.20.1