Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp404166rdg; Thu, 12 Oct 2023 08:54:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtQHP+QAnNU59/HYFkuHJJWHPXgS3mslKt+cswHcQICNhKUGLXsh6uCipNmYzV9p3fjLcO X-Received: by 2002:a17:903:1c1:b0:1c0:c4be:62ca with SMTP id e1-20020a17090301c100b001c0c4be62camr25029233plh.17.1697126091872; Thu, 12 Oct 2023 08:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697126091; cv=none; d=google.com; s=arc-20160816; b=JGAeQB7rB8rkBpmajnaI3llOJ6bEK5U4kfaxe/uiDuMhsa2cs2VDVUvEXjCYGnag2P Pc3GYiNMXgnAtXC2vvAa1gXn5qvqVzWRDKneSWIuKF3Hsz0NrE5gu+9rmBUSkj227swB F2jLDFdjIRIJ520/xpgOswq7jJ8oCIeEj/DcmXNNrFNiBSmOHr1mTKTpron5jFQH8/p0 nSKnSS0fxX+GKne1aMhCkfMK88zZJJ0soZmaorFrMXpivTpPB155MpI1hf90pLBZ/IpA xMl665ycya03wAv9tHoqpb2nBlrjKrL+0s7AvsfuKNBcqEI1AR1APe27kF+L1R2+3yDQ la0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:to:from:dkim-signature; bh=yAZU4Pk741vAbZvkeMxKiM1SzamVAmcDAVBgbHa+bw4=; fh=qW0phhq3fb3oiohK/Mu9j1KY1zyRNiiioKFc5anvatM=; b=mJitvoXB1Tbiz/jOkM/DagkdK+5jzkXn0PciI9MnXr+SBjX5T5l4yT22XVQe2Ed4Yn 3C2OuHY5njPphwt+5Ko6/a9Tcm3R+FFSWKsbalHFNFEyuEn776Lv20xfprhG6KKqXx+Z ARKXoVQx6841oy4Or9nVkcWMVa1sg81y8OhrWDsYDsbq2uypmnkIb81BzRs/Mb/Cbm2I zHa0JnYWkCr0R2UBd8S0GlEtbdYp2/91ajGly+Kpat3fACJsXm+zFb1Aog6hW2aKq6qh 8YL0n49Y/bDXUMKUBMEjqA+s5MlOvDUMIKB3AzTCisz0RucHggdoTSefyI/9a2E2hRH8 fSmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nukdWWoO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 13-20020a170902c10d00b001c3a6902ff1si2370834pli.288.2023.10.12.08.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:54:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nukdWWoO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-wireless-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 agentk.vger.email (Postfix) with ESMTP id 03213819D208; Thu, 12 Oct 2023 08:54:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344003AbjJLPyq (ORCPT + 52 others); Thu, 12 Oct 2023 11:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343986AbjJLPyp (ORCPT ); Thu, 12 Oct 2023 11:54:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAA1AB8 for ; Thu, 12 Oct 2023 08:54:44 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CDE9C433CA for ; Thu, 12 Oct 2023 15:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697126084; bh=tPJ9KrNVeE06pPoJlJHfmSHhz2Dtk0XGoPa/vNvC3MQ=; h=From:To:Subject:References:Date:In-Reply-To:From; b=nukdWWoOVN6S5cw+AUaCO5/JhQveymGlYU1akTShs5svn1OSrMsLwLuCbnw2gYrKW 1aI73rNvhy7MzUWsRJdPxZDgqQFfawG/ldX4EhcDh8nrND9dDKWm3LaBC2J11DVWNg CoIjk75g0BfLrANX4I1XOOyYwYdVJoofgWzRXJ4pJ2/sx/OFTqbzp3bSHJ3mPypdmU YRBzw9DFkCnYMBC2R3gG4ajWW/fzIzrwpyybnIYPMmMg4Dio+ILNPwSKgwLIJnWU+i Rk6pG+f/1kAks1LqEr9p7KajdOYGxQc+e19WCLs/RMsPAglnOV3hlV3vVyCkf+SQNh xUO/Yz3ctbtWw== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: Re: [PATCH RFC] wifi: iwlwifi: fix format-truncation warnings References: <20231012140251.3473708-1-kvalo@kernel.org> Date: Thu, 12 Oct 2023 18:57:16 +0300 In-Reply-To: <20231012140251.3473708-1-kvalo@kernel.org> (Kalle Valo's message of "Thu, 12 Oct 2023 17:02:51 +0300") Message-ID: <87bkd3g7fn.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 08:54:47 -0700 (PDT) Kalle Valo writes: > On v6.6-rc4 with GCC 13.2 I see: > > drivers/net/wireless/intel/iwlwifi/dvm/main.c:1467:19: warning: '%s' > directive output may be truncated writing up to 63 bytes into a region > of size 32 [-Wformat-truncation=] > drivers/net/wireless/intel/iwlwifi/dvm/main.c:1465:9: note: 'snprintf' > output between 1 and 64 bytes into a destination of size 32 > drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1307:19: warning: '%s' > directive output may be truncated writing up to 63 bytes into a region > of size 32 [-Wformat-truncation=] > drivers/net/wireless/intel/iwlwifi/mvm/ops.c:1305:9: note: 'snprintf' > output between 1 and 64 bytes into a destination of size 32 > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:549:33: warning: '%s' > directive output may be truncated writing up to 63 bytes into a region > of size between 48 and 56 [-Wformat-truncation=] > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:547:9: note: 'snprintf' > output 9 or more bytes (assuming 80) into a destination of size 64 > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:729:33: warning: '%s' > directive output may be truncated writing up to 63 bytes into a region > of size between 48 and 56 [-Wformat-truncation=] > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:727:9: note: 'snprintf' > output 9 or more bytes (assuming 80) into a destination of size 64 > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:989:51: warning: '%s' > directive output may be truncated writing up to 63 bytes into a region > of size between 46 and 58 [-Wformat-truncation=] > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:987:33: note: 'snprintf' > output between 7 and 82 bytes into a destination of size 64 > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:984:53: warning: '%s' > directive output may be truncated writing up to 63 bytes into a region > of size between 40 and 50 [-Wformat-truncation=] > drivers/net/wireless/intel/iwlwifi/iwl-drv.c:982:33: note: 'snprintf' > output between 15 and 88 bytes into a destination of size 64 > > Two of the warnings were easy to fix by using strscpy(). But the rest were more > challening. For now I was only able to come up with artificial testing of > snprintf() return value but that doesn't make really sense. I marked the ugly > once "FIXME" in the code. > > Any ideas how to fix the warnings properly? > > Compile tested only. > > Signed-off-by: Kalle Valo I didn't notice that Gregory had already submitted a patch: https://patchwork.kernel.org/project/linux-wireless/patch/20231012153950.f4465b4b4e2b.Idced2e8d63c492872edcde1a3ce2cdd6cc0f8eb7@changeid/ -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches