Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1343144ybf; Thu, 27 Feb 2020 09:09:50 -0800 (PST) X-Google-Smtp-Source: APXvYqwtVsbIEjpgWSlOsOdlhXhPi3c1pcz3B4OqwIXVa0TGjxaeyKOrYAo4YjHS3c1Y3iEW4pip X-Received: by 2002:a9d:6183:: with SMTP id g3mr616619otk.304.1582823390114; Thu, 27 Feb 2020 09:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582823390; cv=none; d=google.com; s=arc-20160816; b=S9Bo/qW7LvvZqSWx0shn55g8LlINKGtSXH8Q6PAk1ma/FYxauxJYuS5Vh+j/EfNTpi O5LwBnmR4GVOSGEE6GM0qFeoEgVKr1U31JZB4CanIP/j9aq1lqULNIhbEWrEs6RjaEjE NJzUvofefPpyLoiyvmGOmLp3owZ9KdZeN0NWa2jRyDt8kbpwisrhhJnHxIzgvsU1MDpt Hh106y/HBV1/WIYXh/ql8ajiGEKDILMX7ZWn/uLzGZEEQPEbgI4yj4jvjITCo0QIH7HI ZHNyRBgQWqVRXkwp8jdKbfMU9/gRsnhtwXoaPM+ZO9JGGVj4LenknzMaGFY50v8DNNxC PYEQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0d2ikdqfSzyCyHKBwzyOB/NzazDViDKr5gLhXg7TE5w=; b=FBa0OWAw+GMxGypI/dGPUJvbObGspiBDYbvVi0nzPYoiXWrRDywUq8idHtrg/sPcWZ u/GtSxh7t2rM4FyS5gGx7kKI+NEZkA3voztZjBnGmYvzAojCTSFDp2Zb1wQH6ljspbMe L8muhawyGEOLy3YehaRAxNzRAUNh3mEgFRathwzgdqpcHqakG+W6txOZ1gDQV1NYUh6/ n0TPvxIgZ7OqgayebOG1GMpLdyBmr0TUUYcC7xxrE+y4l4KGm/5kgKO6Lz/uJp2YIJU2 /ZUYW8USOeGeMsBFAaAlTxOoXpDilNdUiVr6A58/abHSYNbTkHq4dBZLNQIbgjnd/7/e hl2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cBmmg033; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si2049369otq.115.2020.02.27.09.09.37; Thu, 27 Feb 2020 09:09:50 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=cBmmg033; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730107AbgB0RJ2 (ORCPT + 99 others); Thu, 27 Feb 2020 12:09:28 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:39290 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726460AbgB0RJ2 (ORCPT ); Thu, 27 Feb 2020 12:09:28 -0500 Received: by mail-lj1-f193.google.com with SMTP id o15so40220ljg.6; Thu, 27 Feb 2020 09:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0d2ikdqfSzyCyHKBwzyOB/NzazDViDKr5gLhXg7TE5w=; b=cBmmg033uMjVyyiiZzBQ6LYyy+VgUvpGxjDYnJbqsFA5QYw4c0+iBD+yt8NL3fyA0z 1mhds+EI/xVyu45GOaJ12WhmGvH3xJ4r8WG8AXlPRIgvu/FZ6FEeemJCuIz+Wpwov7m2 AT1+Y90aYC9YIILe1wY5yqYOvyStCo09yByNLSItCx+gkhB6dGCJJQdX69wXJOpMDx5Q kv5wJcBKwIUyY2qFVR8zCsY4CzWjhPtccyMk4ZvVFe5jsVGdiUnTx2fXJKMtD3jvKMqv q4UExMEqTsprti7lEPu3ezmD8PS3vUPu4YT4Xbg3onwy2gaYHmDmUzyimxrwl5kgBCt1 KJFQ== 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:mime-version :content-transfer-encoding; bh=0d2ikdqfSzyCyHKBwzyOB/NzazDViDKr5gLhXg7TE5w=; b=iKTLlkwG7+GMd6i4/bGmxIuoMa+C4pZL5Oa1KxPMWNZYqihToYsjrmE94irzvYt3e9 rqCw5XHcJIKEuKg7YGcQVzbp65b+6PjQSiwUno/GTncBxJ3G0P5Fu5chN56WhOIU52be eDVhRXUjYgtYURFcp7A5wLY2byjomg+B8+o7i7RaHBZZNwncR/6uWWNbexQo/kNPapiw UCWAzoO6zrila/m04kSwBywhIBvIrghQph6i/Y2pyamCxnBSsyW0tnC7X8c1O+q1zx5I NWl/v03GKW0HC35hgUA0fbwn4msA47nGJ02P7fvw8jiAu+F2jAszHgts4wfanjwVoJlP nhUw== X-Gm-Message-State: ANhLgQ23NwqsGVS2ZTaYQOjhbXx9DVHsQTq3cHu8sBaN8ch4WzZaP2Gx FO+xb1yuQqo7dYxsHa9lAPLcqQbp X-Received: by 2002:a2e:a58e:: with SMTP id m14mr59358ljp.68.1582823366131; Thu, 27 Feb 2020 09:09:26 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id j11sm3049513lfb.58.2020.02.27.09.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 09:09:24 -0800 (PST) From: Dmitry Osipenko To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RE-SEND v1] PM / devfreq: Replace strncpy with strscpy Date: Thu, 27 Feb 2020 20:08:54 +0300 Message-Id: <20200227170854.9949-1-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 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 GCC produces this warning when kernel compiled using `make W=1`: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] 772 | strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); The strncpy doesn't take care of NULL-termination of the destination buffer, while the strscpy does. Signed-off-by: Dmitry Osipenko --- drivers/devfreq/devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 8494c5f05a73..2011f64bfa3a 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -769,7 +769,7 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->dev.release = devfreq_dev_release; INIT_LIST_HEAD(&devfreq->node); devfreq->profile = profile; - strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); + strscpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); devfreq->previous_freq = profile->initial_freq; devfreq->last_status.current_frequency = profile->initial_freq; devfreq->data = data; -- 2.24.0