Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1371276rdb; Wed, 20 Sep 2023 07:27:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUKDLk7K11JCFFZLLN+yI6kEkTsJ0OsD7sBVpQ1XLD79xD61b369vFPCxPduiDBGLET2QX X-Received: by 2002:a05:6870:ec92:b0:1b0:17f2:6518 with SMTP id eo18-20020a056870ec9200b001b017f26518mr3207643oab.42.1695220061176; Wed, 20 Sep 2023 07:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695220061; cv=none; d=google.com; s=arc-20160816; b=jil7DPB/1Uu63CfjvS6WQ5eSfEkKioByVqJfKcARk807acigFxtHNoRlZ2mkh+1vml o4TMTMS/n/aT7psqJ6lpM9zLW+6w927ab+F31MEYQ7/S1u/UrQeJMfq1FQCCcSLi8CJQ OfuQIB6DdgKAlKrliPk5262ZfvmbTlCsV9UJmgh4+4Bhnj4fKswxAtUHz67KDWetVk2O aWCdneI0TOPFrJeHfzcJ9DDkd+Quxj53qV0tb2FCnEQRPP7pn4hfMEGKtLbiLpwcWxDg xM53dYR5GNF1mVaeIY1FxtoU+347xoclXAYG+ACFA3u8Lk9Qp32XodW4BYYMO7S28IXY heTg== 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=JhQt5r0Le6+h2xnofVBZsiVxnN2m5BNnncwVgfDlUeM=; fh=/D+/N9nOwII8W7TblKMD67Va5CE1GlljOR3RXb7tg7w=; b=stlej/ii4c3I10VAq7OE6jix7eoQ++yFno76IBg73gQBFbLbCUiu5lm1WOXNINfrpE iW+mR+O1bqTSY1srHMwNr3nv3kFjPuQmxsUffDoWlvw02wb4/h7oVHbY0BAhfVUBJW2b p1LxdMyP9cmTZWnHM6TumAxSMgLje/Up7cPUECs2S1ExwiQAfJGCfaq2CwTgwALqyniw 3FPBJHaWX79Xsivcu+8rw/rLd2hSVdTAHEWF9axFdpuhweMr4xLW0uk5I1+TFp3GpR8u 3B+8mcU2HiybVAeG9yS8LF2NlfzWl01njY7vP+hAlW+LiEFyLFokmZc023SRpBPaReQA 6O8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BMmrF6sT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 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. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id t23-20020a656097000000b00577ed0133d6si11293408pgu.454.2023.09.20.07.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 07:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BMmrF6sT; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 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 CAE9481DEEDA; Wed, 20 Sep 2023 06:17:11 -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 S234731AbjITNRK (ORCPT + 56 others); Wed, 20 Sep 2023 09:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234623AbjITNRI (ORCPT ); Wed, 20 Sep 2023 09:17:08 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37EA1A9 for ; Wed, 20 Sep 2023 06:17:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5092C433CA; Wed, 20 Sep 2023 13:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695215821; bh=aokdul/EDn4ykOaB3uYcrsOCpdNgFA8ymZpAAnb64FU=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=BMmrF6sTWe3QQf4tn79LDmTXyoBnxzq1G0wFjipzhbVmAtUxAUoj4Iv6m9Jrflj0C LVujNCJfOfhvxjJ5rWANq1pTq+5jOm+T4VB8Vttzr9GBZBNH0yyLyWpqWh6rEnuqHR KL+bVbOdQYKEsmFDdfa4lqhbIQvZENRexAS5yXd1QhIy9w0tVmUzBQHSLH+1VErcjW 3ySgN8AfjwhW3Fn56qeRcJ1lBOEDQJStaziib15/9JDeVeSCq2m6AMdW4RXJTn2+WC 2Dg5EpLZbz1yA4m+83HmqKIVoBgx9aVy92wx+cWvnadzCSnZ2fPilGQ5gvr7t+l3Mf bSdd13prGCsVA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH] wifi: ath9k: fix clang-specific fortify warnings From: Kalle Valo In-Reply-To: <20230829093856.234584-1-dmantipov@yandex.ru> References: <20230829093856.234584-1-dmantipov@yandex.ru> To: Dmitry Antipov Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , 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: <169521581913.1118199.501040563383368808.kvalo@kernel.org> Date: Wed, 20 Sep 2023 13:17:00 +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]); Wed, 20 Sep 2023 06:17:11 -0700 (PDT) Dmitry Antipov wrote: > When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've > noticed the following (somewhat confusing due to absence of an actual > source code location): > > In file included from drivers/net/wireless/ath/ath9k/debug.c:17: > In file included from ./include/linux/slab.h:16: > In file included from ./include/linux/gfp.h:7: > In file included from ./include/linux/mmzone.h:8: > In file included from ./include/linux/spinlock.h:56: > In file included from ./include/linux/preempt.h:79: > In file included from ./arch/x86/include/asm/preempt.h:9: > In file included from ./include/linux/thread_info.h:60: > In file included from ./arch/x86/include/asm/thread_info.h:53: > In file included from ./arch/x86/include/asm/cpufeature.h:5: > In file included from ./arch/x86/include/asm/processor.h:23: > In file included from ./arch/x86/include/asm/msr.h:11: > In file included from ./arch/x86/include/asm/cpumask.h:5: > In file included from ./include/linux/cpumask.h:12: > In file included from ./include/linux/bitmap.h:11: > In file included from ./include/linux/string.h:254: > ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field' > declared with 'warning' attribute: detected read beyond size of field (2nd > parameter); maybe use struct_group()? [-Wattribute-warning] > __read_overflow2_field(q_size_field, size); > > In file included from drivers/net/wireless/ath/ath9k/htc_drv_debug.c:17: > In file included from drivers/net/wireless/ath/ath9k/htc.h:20: > In file included from ./include/linux/module.h:13: > In file included from ./include/linux/stat.h:19: > In file included from ./include/linux/time.h:60: > In file included from ./include/linux/time32.h:13: > In file included from ./include/linux/timex.h:67: > In file included from ./arch/x86/include/asm/timex.h:5: > In file included from ./arch/x86/include/asm/processor.h:23: > In file included from ./arch/x86/include/asm/msr.h:11: > In file included from ./arch/x86/include/asm/cpumask.h:5: > In file included from ./include/linux/cpumask.h:12: > In file included from ./include/linux/bitmap.h:11: > In file included from ./include/linux/string.h:254: > ./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field' > declared with 'warning' attribute: detected read beyond size of field (2nd > parameter); maybe use struct_group()? [-Wattribute-warning] > __read_overflow2_field(q_size_field, size); > > The compiler actually complains on 'ath9k_get_et_strings()' and > 'ath9k_htc_get_et_strings()' due to the same reason: fortification logic > inteprets call to 'memcpy()' as an attempt to copy the whole array from > it's first member and so issues an overread warning. These warnings may > be silenced by passing an address of the whole array and not the first > member to 'memcpy()'. > > Signed-off-by: Dmitry Antipov > Acked-by: Toke Høiland-Jørgensen > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. 95f97fe0ac97 wifi: ath9k: fix clang-specific fortify warnings -- https://patchwork.kernel.org/project/linux-wireless/patch/20230829093856.234584-1-dmantipov@yandex.ru/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches