From patchwork Tue Aug 28 09:31:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 145303 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp966640ljw; Tue, 28 Aug 2018 02:31:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZWIPD+AaECa8cIa3y8YaT6TX0qqPRIg9RsyczkYgkQRWd5dVHhLmwhgj0iaRJQ2KDIl6Xx X-Received: by 2002:a63:485a:: with SMTP id x26-v6mr694878pgk.375.1535448693160; Tue, 28 Aug 2018 02:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535448693; cv=none; d=google.com; s=arc-20160816; b=DH6PHsGx5dr8zZsHRZllmGIqi8Oc4kyUj4V7q43xr3pasfWqq2nrfvFXyZ3Q615IAM 9OL7Yfu5qpDqy1hMFFRQm/oJbb1J9i2zgXk7bPhfNIeq/rsRjIWwMu/ZMQYM0uAcC2f8 Akzzc+LP55B69G4xTQdy+Si3WmLgYhOPxIDc11q7UH0Ulv0ZiPe9L6nPMRevXsLgTJri l2vsF3JDSZ2plkRdUq+ed5fE5NMiCIxbVs0e1LwGe5+YeRLdvEkvXoTRNxefQ9D9FYrK WWUyTDKy7XU6cwJhEh4GYaNO1b8zXwKI68oaxWNhYUA9wzqQQGhg8umXzOMc4fDLHbNp J85w== 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 m29-v6si542081pgl.304.2018.08.28.02.31.32; Tue, 28 Aug 2018 02:31:33 -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 S1727518AbeH1NWM (ORCPT + 32 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 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(-) -- 2.18.0 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;