Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1076276rdb; Fri, 20 Oct 2023 07:52:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgSxxpTXLrL8Iflaly/brU8EB/BKTFE6YpZg4nIW7qHD3t8M1MNJHrnT4wA5VMDK+w2Y3e X-Received: by 2002:a05:6a21:998f:b0:15d:53ad:22fe with SMTP id ve15-20020a056a21998f00b0015d53ad22femr7878909pzb.3.1697813530412; Fri, 20 Oct 2023 07:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697813530; cv=none; d=google.com; s=arc-20160816; b=i9QaeMap3pVHpLjki+5TldTbBiSGz1gSo7AtUirNfiFurdM2iEJrXcSTKhW7a/gMoe 0tz8Oyz+fjRp1sjomuEXDTcaKdd5wvRLqMAiV7SNZAvytKkvk6iMi0eh/pOGdf4rwspL eWNemVxIrZhVFYMzIFaUgR4zH6FYGy/fdf1SmDtOPU6SxkebLbGvpzD7PUqO0iqywjch Mmk47OHsIkL6Jj7BVaXEqPAQkqrayacPGjomqCrL5PYLyOhdWcGNGJO8ewfcXb/x2TNf QsT/sfc9BtY40JONDSg7qHsXw00onx0AxqhS3uG0YiWy00XPTqI51uLN3uK3191AeIJZ h5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=wCQW3Mmwhw754roGbP0U8SKwSubQ2D0pGcvYlWgeWbs=; fh=lVCYI9qS88icxuErcmD2vwTN2HVAldgzYtPBaCl8NWw=; b=jyR29veF24edxDUKYp4q6TmumfvayrdIAfYe0yWQZLset1wrqZ9aiK07QjRHnkLqGr Yo6PfMlY13UI6AoqzGRJyKkGVeA4KClXHmK4kUOzQBJG/c63jbICmhcsEUtkHXQ90M7J juNwha0c8qwbcVIKl8KVZjMUSKVIsfhdNeEeWZnzKs6AdQmgFf3kq7W7Bj8W3Kb40tYL Y9ivug1mreZJ0lVUKNmGYtJ2ZsCC76UxFfHl4/1cGnmtivOFhJWnZNSZ3D979KwdcbAp a7pRsLGLlI468YHbKghl738iwVonMoP21aSEqvCC9aP5oNGLTlLn5gmMS3Z83qw3bF4o UfMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hM+6X9+c; 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 u185-20020a6385c2000000b005b881a12a14si1085676pgd.226.2023.10.20.07.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:52:10 -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=hM+6X9+c; 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 7CF7B80947D1; Fri, 20 Oct 2023 07:51:01 -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 S1377610AbjJTOvB (ORCPT + 52 others); Fri, 20 Oct 2023 10:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377648AbjJTOuu (ORCPT ); Fri, 20 Oct 2023 10:50:50 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A57541713 for ; Fri, 20 Oct 2023 07:50:42 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FEDFC433C7; Fri, 20 Oct 2023 14:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697813442; bh=oocXcBg6ft4CUNhyxIfcVWaOKp9E5tvsg7MLSUkoIy4=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=hM+6X9+cAci1YHsjKD+2gkYeHWpsoOQ9yb5HL8emXy625rGAD8EdneJmqIoH9X6LZ +V7tguyLFxSrBTD8t6RHIWR5erv/lNiLSm1OwJg3RZ/OGJGUFDaRrqeRrpwlVapv95 CufFx3Q+d2sT1/+Jyv6QHlQaxDD5CrSBxKonv1ogU500E0UaTf0QolhvhErRE0Zqou fE6KAl9W4WYahYIG0+r/w5ZY0DIjDNq9TlaxCxuc+ScR1KbE4ZJIomMVPa6iBR8c40 i7py9v5nyLK1P661bUvJzcvCkZf0esOiXXWnnpopwApLRnt4M2mv0QRXiIdtCuzYy/ g4Ou1tBH1jhmQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH] wifi: ipw2x00: fix -Wformat-truncation warnings From: Kalle Valo In-Reply-To: <20231017165215.143992-1-dmantipov@yandex.ru> References: <20231017165215.143992-1-dmantipov@yandex.ru> To: Dmitry Antipov Cc: Stanislav Yakovlev , linux-wireless@vger.kernel.org, Dmitry Antipov User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <169781343894.352343.15503426978176886839.kvalo@kernel.org> Date: Fri, 20 Oct 2023 14:50:40 +0000 (UTC) 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]); Fri, 20 Oct 2023 07:51:01 -0700 (PDT) Dmitry Antipov wrote: > Fix the following warnings observed with GCC 13.2 and -Wformat-truncation: > > drivers/net/wireless/intel/ipw2x00/ipw2100.c: In function ‘ipw_ethtool_get_drvinfo’: > drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:63: warning: ‘%s’ directive output > may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=] > 5905 | snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", > | ^~ > 5906 | fw_ver, priv->eeprom_version, ucode_ver); > | ~~~~~~ > drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:9: note: ‘snprintf’ output between > 4 and 140 bytes into a destination of size 32 > 5905 | snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 5906 | fw_ver, priv->eeprom_version, ucode_ver); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > For ipw2100, 'ipw2100_get_fwversion()' says that the firmware version > is no longer than 14 bytes, and 'ipw2100_get_ucodeversion()' uses "%08X" > so 10 bytes should be enough. > > drivers/net/wireless/intel/ipw2x00/ipw2200.c: In function ‘ipw_ethtool_get_drvinfo’: > drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:63: warning: ‘%s’ directive output > may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=] > 10392 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", > | ^~ > 10393 | vers, date); > | ~~~~ > drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:9: note: ‘snprintf’ output between > 4 and 98 bytes into a destination of size 32 > 10392 | snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 10393 | vers, date); > | ~~~~~~~~~~~ > > For ipw2200, I assume that the firmware version is no longer than 14 > bytes as well, and, according to ipw2100.h, firmware date is in > 'mmm dd yyyy' format so 12 bytes should be enough. > > Suggested-by: Kalle Valo > Signed-off-by: Dmitry Antipov I tried to fix this a bit differently: https://patchwork.kernel.org/project/linux-wireless/patch/20231012135854.3473332-2-kvalo@kernel.org/ -- https://patchwork.kernel.org/project/linux-wireless/patch/20231017165215.143992-1-dmantipov@yandex.ru/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches