Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3228021rdh; Thu, 28 Sep 2023 06:24:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHFppCSjNc/5pzYGKxeul5808ut2CuDE7ChZLQULP19rXRblznGIobpLxU9Bb3JybUCEqe X-Received: by 2002:a17:902:b58c:b0:1c3:3347:996e with SMTP id a12-20020a170902b58c00b001c33347996emr976396pls.23.1695907493547; Thu, 28 Sep 2023 06:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695907493; cv=none; d=google.com; s=arc-20160816; b=Th7QScuojVDVgyDZGEkz68dn0lgaPmfsQPQQy1Qp3YRrAML856c9sv8dKZ2yiAXBq8 GkLEY+HI96gkyqkcClo+K6jLk64uLfgtX5DZZjNcyopFX3wIxFXAZjOZFri1SW5tluVE c8WeOoTUJfsx2gWtLOGcECiup36CJSCJhlKHP826eFjrK1JM0LMlSa62F5WigoApLw10 uN7sXsAEIzuprMajHdJpUN1ZCuuvXxRZsNYGYrMi1pK8EUqktc2MUePjya3mOneFpdOj UZmPR0FzjLNaP8qzjPiWD0+JjkLoxlRVEH5DmeZWFIuIF7QP/T1By99VsJVWkbQOV6BN 3Iwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :message-id:subject:references:in-reply-to:cc:to:from:dkim-signature; bh=vizJm+cN4mZXnOsy5rmr/CKWATLl3x1otUzbgI7zdhc=; fh=25PlGTSj/HXjFHGju6Xs0dmEGo8MhgUOK79hTDNmZM4=; b=KppOEXPhck4jdcQDbuRomSkJQ1gXwkludarav8mNP8jA2H1uaS2BPpwsUdg++3dFHC urvLo+iblqXfQlK9hFQb+NnJQuT5kpqtbpeMCEitFxvDcHmEksm/LU5rGY+RuNpST+87 SLG/z1Ok+j7Zrvw86VrJladZ2dUQ36W3xFrX8erZ2ygRs0t5/a3IofPUbAuRa7os7pkQ 7vaHC6653O8uOjROUM9uEY5jgyk2vN2xCa9lEdj497ZaF2RyvqQgb513XhNJ/6zKjDvU rDhhLJBdPIFOjHVSJDy5Rf9FG3o7lhiv1mPPywd98POnEZi1+pBzGpL29B3vPGsLoDfE yAbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G9QO6tvR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id kr6-20020a170903080600b001bbb39c68b2si17131026plb.178.2023.09.28.06.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 06:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G9QO6tvR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8A1E78026BBD; Thu, 28 Sep 2023 06:09:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232674AbjI1NJh (ORCPT + 99 others); Thu, 28 Sep 2023 09:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbjI1NJf (ORCPT ); Thu, 28 Sep 2023 09:09:35 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09E98198; Thu, 28 Sep 2023 06:09:34 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1249C433C8; Thu, 28 Sep 2023 13:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695906573; bh=Qq0hi3e2tKtQJ3+Z8bOvfTj1CKrpaItZITJxOy4HsYk=; h=From:To:Cc:In-Reply-To:References:Subject:Date:From; b=G9QO6tvR7OcWm8lZ1U+06XFAkTtd20/2iYWGGS8m9DpGgk3Wqbh0igL8reiBJW8XS 2/N0r8BxxvZeWJNbTzMszbxNsZKtyzfrd0TFew5e32ttARPUYMRQy8KZEqiXK9hqlL pJb2dRM7QlU9IDPiYPt2z/gTkmzAK8k01CzvB4PtXk0sTXQly94hcnAt+akohNi6cE 1CYHqrUw2bZ3NPcZnrs87HAluKxL90XedpoHwpAe+0OBxjX5g0U/WqtKIMgfhS6UHB C91lbbCQoXQQuy+Z4O5ninrDG0azWdU/kvvM/bWhOdvwzC6UbM9Z3lqvuK/Ha2pFjk DEcsQIV0YNEDQ== From: Lee Jones To: Pavel Machek , Lee Jones , Bryan Wu , Linus Walleij , Jamie Iles , Christophe JAILLET Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-leds@vger.kernel.org In-Reply-To: <3f4be7a99933cf8566e630da54f6ab913caac432.1695453322.git.christophe.jaillet@wanadoo.fr> References: <3f4be7a99933cf8566e630da54f6ab913caac432.1695453322.git.christophe.jaillet@wanadoo.fr> Subject: Re: (subset) [PATCH] leds: trigger: ledtrig-cpu:: Fix a warning when compiling with W=1 Message-Id: <169590657165.1583104.6448203115570808181.b4-ty@kernel.org> Date: Thu, 28 Sep 2023 14:09:31 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 06:09:41 -0700 (PDT) On Sat, 23 Sep 2023 09:15:38 +0200, Christophe JAILLET wrote: > In order to teach the compiler that 'trig->name' will never be truncated, > we need to tell it that 'cpu' is not negative. > > When building with W=1, this fixes the following warnings: > > drivers/leds/trigger/ledtrig-cpu.c: In function ‘ledtrig_cpu_init’: > drivers/leds/trigger/ledtrig-cpu.c:155:56: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 5 [-Werror=format-truncation=] > 155 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); > | ^~ > drivers/leds/trigger/ledtrig-cpu.c:155:52: note: directive argument in the range [-2147483648, 7] > 155 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); > | ^~~~~~~ > drivers/leds/trigger/ledtrig-cpu.c:155:17: note: ‘snprintf’ output between 5 and 15 bytes into a destination of size 8 > 155 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > [...] Applied, thanks! [1/1] leds: trigger: ledtrig-cpu:: Fix a warning when compiling with W=1 commit: 5272d74b29929c8395720a7e35971a4f0fb6783d -- Lee Jones [李琼斯]