Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6875506imm; Tue, 28 Aug 2018 02:32:52 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda5CX0w7mM5G3nUZT2k6YmtCLkD+eymVR6d9zENqOomdteqnk1sLmkEQlaGSLmOiulDD2sK X-Received: by 2002:a62:d74f:: with SMTP id v15-v6mr668773pfl.257.1535448772051; Tue, 28 Aug 2018 02:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535448772; cv=none; d=google.com; s=arc-20160816; b=ZsAOYpS+MrHURPybaurXc0+iTekStVQC9i9o1h3TpymlS4WgQqCTz4OMhsFa9pglQT fNRx9JdUTbuKEjTaikAjC5TRRZUdUA1V/v6QJneYwAGMl29UimIYbcx/6CsMfLTHJeAn QaAefQZ3aq3Jt+KO57ULZZjsdp4fUSWUkWoFelDNbFzEKV5Cp9t7dP5oOE/7U/MyB2k/ ju3eV0pj3eaZzEt2wJt0mdhL/oaatlpMPjuPZklnCtMayx4r1qwl2+xRHRwAlCZ9lRBR cWS9WP5f/E6K4UCi7oQQlVt5p2U2CwhUVtKMWrH2KZ0k/BccIs3HwrRxWgpPA0z2w4Dc SJxg== 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:arc-authentication-results; bh=CCrycUkI2igXZYUZAQ5kmKLzX7nJozRTvvvVQw2759c=; b=HjGM5EHOrcyxbhF4MpjT/de/cYsr4w1uA1SDXYAfpL3PM/GOEHI9nnu761fdxTpgs0 V0WgCLgBAIZXH7V6SgRjPmgba4rBtEmmbZh3ThycrhICyj/gFiUNg/PSlvpwg8hwET1U 3bsYjYjGzx+e/7KThDpBEkjMq4B2VXJE5UNnh2tdhijed2aGLj0WSSnMBGCvF3Pb6FBj KC5CpWNz2vZkXoY4KzABNhZebyA09leWkMVhWaorgpGsSPYegPpkf101R6WJJJ8F4cPu ECngL726g7HlZIhC9JWjAX0OjSLHjF0x+GXPlluuE3qHCWH8XmevBh+DFwoBKcExWsTt eeag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=APtlpFpt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18-v6si525648pgh.530.2018.08.28.02.32.34; Tue, 28 Aug 2018 02:32:52 -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; dkim=pass header.i=@linaro.org header.s=google header.b=APtlpFpt; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727404AbeH1NWM (ORCPT + 99 others); Tue, 28 Aug 2018 09:22:12 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34210 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727162AbeH1NWM (ORCPT ); Tue, 28 Aug 2018 09:22:12 -0400 Received: by mail-lj1-f193.google.com with SMTP id f8-v6so836383ljk.1 for ; Tue, 28 Aug 2018 02:31:25 -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=CCrycUkI2igXZYUZAQ5kmKLzX7nJozRTvvvVQw2759c=; b=APtlpFptnLaId7dDomOw0x8P0SSqHIgQ1fIFO03qLvZWIHs/rvQPZ6OVLdpTaDQaNq cKMOT1V+14KWUU8ZMHQeqDEfBBFU89qMOYOhZPf/6iz11twlbPZSMwa9xjeM2NQVm6t9 5GrLTXPyzby3fQ11TzeT/DFzpr0ySc1A53Euo= 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=CCrycUkI2igXZYUZAQ5kmKLzX7nJozRTvvvVQw2759c=; b=fmLQt8ERsXV1OtfKwnZ18wooTCa2kK83hfKGUFpQCqAEK9yjgGcYdN6JI2+fWwPsnB aWEqEOW+XIxot2ZVOVYJmsILlg3+pmJ1Ui3E4pzm/EShP7dbOFwv/7jrMQuzmtso6T3Q LDH4X1vq0LO+x95mzM4QMAp22aEbnPuYTbVOA80752IlaeHsrk6yg5BUDpWc8q92LUX+ 48/GJJvwaS8EsYm5cbPb7ovBmQpQay/eDDIeQckAvsqRFQItv3VY8VYBwBkq+Huvt0ca 4/rAyihWRAzXAf3LShnHv08KhrvDHNVYPDwfKPwWe2EVJR3qFbBVYiybjxkT6bcvhJg4 H+Iw== X-Gm-Message-State: APzg51Cd8s0WNhL8jXbGnLwOeGz92V2R1tUFtLYSl99EKyZiVjRvgeJz N2WT0CeM/qkjQpzKGezc1D0wZPkF1JQ0sQ== X-Received: by 2002:a2e:9198:: with SMTP id f24-v6mr647817ljg.64.1535448684304; Tue, 28 Aug 2018 02:31:24 -0700 (PDT) Received: from localhost (c-2c3d70d5.07-21-73746f28.bbcust.telenor.se. [213.112.61.44]) by smtp.gmail.com with ESMTPSA id j140-v6sm127633lfg.16.2018.08.28.02.31.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 02:31:23 -0700 (PDT) From: Anders Roxell To: trenn@suse.com, shuah@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH v2] cpupower: remove stringop-truncation waring Date: Tue, 28 Aug 2018 11:31:18 +0200 Message-Id: <20180828093118.28326-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: 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 The strncpy doesn't null terminate the string because the size is too short by one byte. parse.c: In function ‘prepare_default_config’: parse.c:148:2: warning: ‘strncpy’ output truncated before terminating nul copying 8 bytes from a string of the same length [-Wstringop-truncation] strncpy(config->governor, "ondemand", 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The normal method of passing the length of the destination buffer works correctly here. Fixes: 7fe2f6399a84 ("cpupowerutils - cpufrequtils extended with quite some features") Signed-off-by: Anders Roxell --- tools/power/cpupower/bench/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index 9ba8a44ad2a7..84caee38418f 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c @@ -145,7 +145,7 @@ struct config *prepare_default_config() config->cpu = 0; config->prio = SCHED_HIGH; config->verbose = 0; - strncpy(config->governor, "ondemand", 8); + strncpy(config->governor, "ondemand", sizeof(config->governor)); config->output = stdout; -- 2.18.0