From patchwork Mon Mar 4 11:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 209509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1354920dyc; Mon, 4 Mar 2024 03:23:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVPpGXSUNHeW3aMAMU3dMI1+3xf5o0CN4c5ddAkpR4MpTZxTL/rxvdWMPb/mTQ+h26YfQE3lqKtI70JIiLdCJ+ApdyRvw== X-Google-Smtp-Source: AGHT+IE4V2IvC1bGJnamPCkCMYBketwqpyHOp9t09T+EybYZJ320hrdGRb6sDmOeAKhjk4qm102n X-Received: by 2002:a17:906:ce26:b0:a44:415d:fa3a with SMTP id sd6-20020a170906ce2600b00a44415dfa3amr6210620ejb.40.1709551384098; Mon, 04 Mar 2024 03:23:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709551384; cv=pass; d=google.com; s=arc-20160816; b=uKMRRMyF9zHbH8RpmW38A3U3R4RN8SJYQnclUe3Xus7Ky/1MDsFxQPM07knUacCoLc dlKveUHdcsuvCN/YA9e0cE2ME2W1NU7hsB4diJggB9zvC0deF+KBiF73Px2S+SuMlAv7 woz7hs2BQ79CmmigIMxkVoPS5qdRqtHDvWSFrjA9B/LJuGnXfdOBWlg+Wx6ymCZ3V7vw tzUvHtKWa/uOmyUMT/trar1J+cITg5tkxZwZfKYGUx/gJk5m5S0jlXUDb/873UVCyGCY djEh+Pf8658H0Tx6bzB+2dbHRfhQkz1I2sjiNJ9ofyA2ORZYGVI+dZFZo6CpdGRj2gO0 YyPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=xfdTBXeEYKopzUYmugLEzbdirAWxeCvLjKk0bWULobA=; fh=QM7KxXnr6KxMuIh5yI1tFJNh9G9jPNyCnamHPXjc6DI=; b=Fw3AaC3MgHGO4aKBfn3cQbU2066zKiQ12Z8XoG81bYLTKciaMlrfhTA8vwWeYfZyWV PhCXu3Dby5fXGeoERQFkAh1J4j5IQ9ccUy5Eg5IbjEH0H6mctxFv6ynhMrFoB/+gIcXx MNawjGpykFv3swKkLBYfjx8yEio5p1pkdFg8hIRxSRa6uM33217TJgv0Lh6thxubS1FL m4QrObZoRL9enIRL0rGBWA6/s0r9Bg5Z2Y73wlhPz5et1VmYVSjjgWfQc++O9Kht1zUr eoDJ3GNIwf++pwN9zYKXgb/sShXJ+bNct4fFi2t8wafl+1qBzZ9YWRGKindu9SdDlKyb 8JGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jna1ogaf; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90503-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qk19-20020a1709077f9300b00a44d54b6317si2051120ejc.345.2024.03.04.03.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 03:23:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90503-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jna1ogaf; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90503-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B515E1F25E7A for ; Mon, 4 Mar 2024 11:23:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5E0839AD8; Mon, 4 Mar 2024 11:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Jna1ogaf" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3FCB3839F for ; Mon, 4 Mar 2024 11:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709551365; cv=none; b=k9H09ilN074GG0Mxz38ZsfzDTCe1tICqZ8ujNdjjD8Q8CGyrARdBBGKssRgCiU4klq/rfZSWgVii+X31GSVY1umln5AKz8n/MCFBgGc3UzNjeaj8opNp//xypsw3fEr9fm61SnXBY+mGLmJTKdtpTRrUxYpbNAP0My/Vy/gD8+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709551365; c=relaxed/simple; bh=4F/3pvoKPicmhJlfUvzEOvWzzDu4xBXOv6jna4p07u8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=SUlSwqAYRmUHNNW2hji2AFm03qXKYiK7nXqCG1YRuqi2H9CvwpGTmvBGMLWduCvWMErTVSUIopRhrc4YEY4pvMsGgJ4CitQ+syREAgEfCO1aQP8dJATTn0Nh0krfvxlEZrLLP3VuG3WeGE6s/j0rR0pbURZFv4jfdgNk3XYxjHc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Jna1ogaf; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6e58d259601so2740853b3a.3 for ; Mon, 04 Mar 2024 03:22:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709551363; x=1710156163; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xfdTBXeEYKopzUYmugLEzbdirAWxeCvLjKk0bWULobA=; b=Jna1ogafl93NSLBHvs+lxS/585PJk+MolX5HJVQ0KDmwr5gthXGdR7hl6Y6lUKjiOw P1Sky7q+5GNnM/owmUYkYQ315iEestDtWBBtdhICnkrELW/Fm2yQ7THz+GOKCFSudARi LviE1q/GAo7NigqAPzYTCbCFciJAVKLPKGaFV+W0NDEIUxvckeI6p6Gqjo02fp7MoAQI k58kbv7wV61ALc0+Y/cq6/hmmHuK0FPKxBbcUtitJaluKXJAo00aR4N5mqAY3iz1ZNMy PBHEvuQmqJFNuQkOTQHK5acFBkqgO9cJtc6Rd3w6ncNH6EiT2LBrdpjkscG6Ab57UnzE Cmjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709551363; x=1710156163; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xfdTBXeEYKopzUYmugLEzbdirAWxeCvLjKk0bWULobA=; b=j1L0WG0FTFV6/A395OoxnhsRxR79kcSELj3pbdtIjcpMugIMR4iZtuYT4YjwNziQXO 5JL9jKdb5De6/RMzF2HMWL+uWgncl6+RxuMZsuXb4KiGMre+b4mP6M3X/j3Yakwxw+z9 EseSejD87CSuOOjbCQHs+8iDVYj6n2dhg1YEPegNGMDZAf4YoDQl/ZY6Pbz2eEOS4+nz vPk4ojofvPvZf4zpf+uUZ0dxVajABUoA9oqLZtcl9UsDQLYqNcClPukU2JIqlz8hOkUE ONYrRePs9znyKws4oSCMO9MptTog2qwKPkMQE+baIBYBxY9C4z8Q1ETLakRaAvWZPGRt FOvg== X-Forwarded-Encrypted: i=1; AJvYcCVvBBJXvLYuMqmLoShshkSnLRzRkJRbVy1hYMlcNkKnFomFgWbxYd/qlrqgr8S7UHJSVzFSdFcsX0WMQZ8aaT5WlZ6pB1RTMZGsEgt4 X-Gm-Message-State: AOJu0Yz8Pr9O9wEEchx8q0uuvT82gTI+HA/ouTnDEsc2lQI6SAzyPDzi Gn30lqOZRS6smIRrLT1/ZkOZlJWw+pKwaebrnMSBgjbRNVak5NcKRTgZfuQN3/A= X-Received: by 2002:a05:6a21:339f:b0:1a0:f4d2:31ab with SMTP id yy31-20020a056a21339f00b001a0f4d231abmr11208495pzb.19.1709551363016; Mon, 04 Mar 2024 03:22:43 -0800 (PST) Received: from localhost ([122.172.85.206]) by smtp.gmail.com with ESMTPSA id x14-20020a056a00188e00b006e55f6cd7fesm6968031pfh.137.2024.03.04.03.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 03:22:42 -0800 (PST) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Dhruva Gole , kernel test robot , linux-kernel@vger.kernel.org Subject: [PATCH V2 1/2] OPP: debugfs: Fix warning with W=1 builds Date: Mon, 4 Mar 2024 16:52:38 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792579336872972346 X-GMAIL-MSGID: 1792594552543970411 We currently get the following warning: debugfs.c:105:54: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=] snprintf(name, sizeof(name), "supply-%d", i); ^~ debugfs.c:105:46: note: directive argument in the range [-2147483644, 2147483646] snprintf(name, sizeof(name), "supply-%d", i); ^~~~~~~~~~~ debugfs.c:105:17: note: 'snprintf' output between 9 and 19 bytes into a destination of size 15 snprintf(name, sizeof(name), "supply-%d", i); Fix this and another potential issues it by allocating larger arrays. Use the exact string format to allocate the arrays without getting into these issues again. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202402141313.81ltVF5g-lkp@intel.com/ Signed-off-by: Viresh Kumar Reviewed-by: Dhruva Gole --- V2: Use string name while allocating memory for the array to fix potential issues later on. drivers/opp/debugfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c index ec030b19164a..27c3748347af 100644 --- a/drivers/opp/debugfs.c +++ b/drivers/opp/debugfs.c @@ -56,11 +56,11 @@ static void opp_debug_create_bw(struct dev_pm_opp *opp, struct dentry *pdentry) { struct dentry *d; - char name[20]; + char name[] = "icc-path-XXXXXXXXXX"; /* Integers can take 10 chars max */ int i; for (i = 0; i < opp_table->path_count; i++) { - snprintf(name, sizeof(name), "icc-path-%.1d", i); + snprintf(name, sizeof(name), "icc-path-%d", i); /* Create per-path directory */ d = debugfs_create_dir(name, pdentry); @@ -78,7 +78,7 @@ static void opp_debug_create_clks(struct dev_pm_opp *opp, struct opp_table *opp_table, struct dentry *pdentry) { - char name[12]; + char name[] = "rate_hz_XXXXXXXXXX"; /* Integers can take 10 chars max */ int i; if (opp_table->clk_count == 1) { @@ -100,7 +100,7 @@ static void opp_debug_create_supplies(struct dev_pm_opp *opp, int i; for (i = 0; i < opp_table->regulator_count; i++) { - char name[15]; + char name[] = "supply-XXXXXXXXXX"; /* Integers can take 10 chars max */ snprintf(name, sizeof(name), "supply-%d", i); From patchwork Mon Mar 4 11:22:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 209510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1354998dyc; Mon, 4 Mar 2024 03:23:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6wr40jw8tTHtaDBBCevfM8OogecoVTVXJ5xHKMeR091IeqnTaNGbKQ53tvCw08XoBqeRdKEsRs90q/bNcuzFn6alAJg== X-Google-Smtp-Source: AGHT+IEMrPBnUuFZHsiFFAiRMmsDpvYr8JkZ02vUyPRZHvt4hSbHvX98IblTtXRPdWoPS5CdAHrR X-Received: by 2002:a05:622a:44f:b0:42e:7557:83ba with SMTP id o15-20020a05622a044f00b0042e755783bamr10800758qtx.18.1709551399362; Mon, 04 Mar 2024 03:23:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709551399; cv=pass; d=google.com; s=arc-20160816; b=omiva4nWXPeM8LwNJgDar42j8FA/nxFLWUniNT0XOgHN126OhHh7gI/1xe1sH7zVlm ngecR2/iY6LaDdRQfQNHgEneGGsPaSqgzaQxKzARg72LFIuL02606i8l1dm4gugUgqFD dU+f+mo8aOCzuJUVOKSVwm+gpzWxz0AnAX5q4Yt07/pHQutSnEaD0AODxEiq/ZKhRsZj qsRNAcO/rTL7oGevK/o0kH/8WFBIGziNPZ+G+Qzjolu1wakU9RfKyIIZ0L+ZWCFuR5e+ 42tpUqGMNW236os0IPF+mjQC7XI5e2kvdlk7r6VSYYEeul4f/sqB7xTwPWtCooMfFw4e jbnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0o2qbRz2LsYMldaZB2Fall4oN2xIZEAZu8iTzW+0lNA=; fh=KEXm8SukIL1jgaU4vm3HJA8Xlxlbf3dqMlmp8Zye1bc=; b=PHrSEXAAf/JtL4Scb3DBHzeJjTM8Z10JoDi+yBs6kbpYYHB3mOpi7M31PMRdJWPwWI 3qrHpB117WQpr7LFidnGipzacr8BgyOAFgpIbW/8ZzUfcRPpePEfsL2Fkul+DIEMKpdw QfL2XoAuiLCCkmKl16onD6Zf2iaPEmyUdgSLQ0aI+e+lW/BBNeWA5e6i80BP189F6N/E GubqODvumvsRqisx46Uw12NMShbVtwHD1mzdYtqDaI4aMoY4MXpoBL5V98mvT1yeQBwL /23va/3vq7PwF7vpwO57iL9pjiL4MxdKxrNPGT9SDVr8PZZDhxKbhZkmY8qlDeSjytlf SkZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d4HGey8N; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90504-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 8-20020ac85948000000b0042db20aba5bsi5077628qtz.750.2024.03.04.03.23.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 03:23:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d4HGey8N; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90504-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90504-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2311D1C234A2 for ; Mon, 4 Mar 2024 11:23:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE78C3A1AF; Mon, 4 Mar 2024 11:22:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="d4HGey8N" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E450D39843 for ; Mon, 4 Mar 2024 11:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709551368; cv=none; b=b5WmUjB29RWCTDoT+AswHRdTN6CCMSdW0KqgQtq5oFVLU6J0XQBjMOhzzmvANK9jhZEzZoqhV849xf1z4nYPPD2qEisI29TOxvFdQlJ/DXKENTOx5wd31NZQmXCfz72aRZIo1ny++dJpJQS8bvyoxrQTbNFCpVybRqyl0oEmOD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709551368; c=relaxed/simple; bh=Am+c6dBF6BHH2/RgeyDCuH3cl4jzRaTZllBvX4joDU4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fVox+TfLJD7olk7FW6ucmSFyptoH17jfQ8FTdqpBZ9YtI3veY4+CSsZ91dv8TQRhCRBX2e0B5+Ru2Ut4gK2mUrGVaC6KXY2oi+DXtvo19i0y075gL1gkg7bc69gBovmQQiokHZtDYBVLN3rhJ1UP05BkHDQXjOwnJ0a2AXD96wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=d4HGey8N; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1dc0d11d1b7so34575235ad.2 for ; Mon, 04 Mar 2024 03:22:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709551366; x=1710156166; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0o2qbRz2LsYMldaZB2Fall4oN2xIZEAZu8iTzW+0lNA=; b=d4HGey8N+RGJYYXIsf1LaNUWUyVqK0xKAYAV6olhhD1fzviqRu1nR4cG7lkpWm74ob EqyuV9WuZNDlcVlTEkWzRmdGRCDI+7hr5RBjAl3/5+UlsaO8+B1wC+msVbmzjvGSFUVS twfv/wd0t5Koy5gzg6SThA6SZGH0vlHNZAoivQHlF85XtG4IMyD5Nti7iD3UZb3gsGiI zAGAgetOvA9Z6fNsCovyH8j0gvwGMav0lsC94uoLppQwCoUDnhWvIc4Y7ZBOkRoO/aCh coG2AUVujbilniFtEZ17IHy2CZBazl8po/hKgOpJmVPn42mAkSXXhoOKC3EojeLtJpIX o2bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709551366; x=1710156166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0o2qbRz2LsYMldaZB2Fall4oN2xIZEAZu8iTzW+0lNA=; b=W3ScZ2BZ1PzA4ptZb3Ej9mzmeFdUWQDLoQ2OseYy//n/rb16Ypz0eZYABgw9pkPQMb zlmQP4oZ/6KifgJGeSwfHBSx09Jheu5h28fkCL2QYLioOWhGwDggJRL0owTRXkxkOhiJ JqX73XOrBo43puuSKKm6dd0SGrnI42o8dapiLy2khI7NUPeR9dyIgimWCtsDYB35cZ2q bLeE+AO978eZKG6NQzMVkaBH4132d2qi1jm2GfItlYzPC1WucGQI+uYTGYvpE62wxTwO ikpn/cVUAzBD2x//vdKYUrnJafh+Hr+oG4yOn45WC1IK7Y5dP1THeO+XfD/P+UOTsR1j Bg5A== X-Forwarded-Encrypted: i=1; AJvYcCWLFMZ+diOI9jupKPJeFGgFzWT55EyhCTofS5GN/GwwJvVjZWVALyAui+TYLg5lDM51WGoa6DnDpzVMq8+l80PP3EJpoB8BKfDsona6 X-Gm-Message-State: AOJu0Ywh0ujw1c3WJKGMRfrwqN2CHGZkpkcYyV+exhlQeEo1R8zpGOF9 nyTQU/H9pmZ7SRv/QLn004OsxbweGhnKstRefcATNNqhCeBMy5Si5q1+VgAwk84= X-Received: by 2002:a17:902:e78c:b0:1dc:fc86:2e7a with SMTP id cp12-20020a170902e78c00b001dcfc862e7amr5384513plb.59.1709551366086; Mon, 04 Mar 2024 03:22:46 -0800 (PST) Received: from localhost ([122.172.85.206]) by smtp.gmail.com with ESMTPSA id e5-20020a17090301c500b001dc11f90512sm8225480plh.126.2024.03.04.03.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 03:22:45 -0800 (PST) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Dhruva Gole , kernel test robot , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] OPP: debugfs: Fix warning around icc_get_name() Date: Mon, 4 Mar 2024 16:52:39 +0530 Message-Id: <0275dc46489419f34765c6ed389c0e9d6245fd31.1709551295.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792594568131591956 X-GMAIL-MSGID: 1792594568131591956 If the kernel isn't built with interconnect support, icc_get_name() returns NULL and we get following warning: drivers/opp/debugfs.c: In function 'bw_name_read': drivers/opp/debugfs.c:43:42: error: '%.62s' directive argument is null [-Werror=format-overflow=] i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path)); Fix it. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202402141313.81ltVF5g-lkp@intel.com/ Signed-off-by: Viresh Kumar Reviewed-by: Dhruva Gole --- drivers/opp/debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c index 27c3748347af..a9ebfdf0b6a1 100644 --- a/drivers/opp/debugfs.c +++ b/drivers/opp/debugfs.c @@ -37,10 +37,12 @@ static ssize_t bw_name_read(struct file *fp, char __user *userbuf, size_t count, loff_t *ppos) { struct icc_path *path = fp->private_data; + const char *name = icc_get_name(path); char buf[64]; - int i; + int i = 0; - i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path)); + if (name) + i = scnprintf(buf, sizeof(buf), "%.62s\n", name); return simple_read_from_buffer(userbuf, count, ppos, buf, i); }