From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E104C77B60 for ; Fri, 24 Mar 2023 14:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232217AbjCXOxq (ORCPT ); Fri, 24 Mar 2023 10:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231879AbjCXOxp (ORCPT ); Fri, 24 Mar 2023 10:53:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E844C0B; Fri, 24 Mar 2023 07:53:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E019C62B3A; Fri, 24 Mar 2023 14:53:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C648C433EF; Fri, 24 Mar 2023 14:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679669613; bh=cUe5k9YVDdRc9tizLqSkC4sL+58aobtjdyZKm0FvMfI=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=Ax3ySt0e0ptLGOJrrn1o4ca8hNbhBXWaA1caWDvkzjXk1vsM+IHuujsegIrstCvZB nqKc/Z4YMhWMBlsd66UopR4hO8DBj6G42RFi3YARx90H94eoL1gVDChMRDEIftIPsl MxVq8rZ/KtxvnX5dQshvAxNclsmCLhBQAmVQLOtp3LJqaoR5R5VHJcoGIuqoBMdb7p U27gOcFttkshZ34dTGyHU5D3JfiQixtqsapG5eIg45COvdT/DvlBslXN1qcKyX/mhP xKntx6XSzfYUUcOEubsI9vuBt5LF0Uhng2rhWY/k+8USpbbQL2+N0ytUVfBUJktXIe BGRAW75I6q3rg== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH][next] carl9170: Fix multiple -Warray-bounds warnings From: Kalle Valo In-Reply-To: References: To: "Gustavo A. R. Silva" Cc: Christian Lamparter , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <167966960882.27260.12323308657924256763.kvalo@kernel.org> Date: Fri, 24 Mar 2023 14:53:30 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org "Gustavo A. R. Silva" wrote: > GCC (and Clang)[1] does not like having a partially allocated object, > since it cannot reason about it for bounds checking. Instead, fully > allocate struct carl9170_cmd. > > Fix the following warnings Seen under GCC 13: > drivers/net/wireless/ath/carl9170/cmd.c:125:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[4]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:126:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[4]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:125:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:126:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:161:12: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:162:12: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:163:12: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:164:12: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:125:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:126:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Warray-bounds=] > drivers/net/wireless/ath/carl9170/cmd.c:220:12: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Warray-bounds=] > > Link: https://github.com/KSPP/linux/issues/268 > Link: godbolt.org/z/KP97sxh3T [1] > Signed-off-by: Gustavo A. R. Silva > Acked-by: Christian Lamparter > Reviewed-by: Kees Cook > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. 72383ed78c1c wifi: carl9170: Fix multiple -Warray-bounds warnings -- https://patchwork.kernel.org/project/linux-wireless/patch/ZBSjx236+BTiRByf@work/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches