Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1942957rdb; Tue, 5 Sep 2023 09:24:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAx4gfletzZTE9/nhAhtQM2n3tHJ6BGuCfA2nXd4/o8YyY+VLtYemvJ6DtuRwshCRia9iY X-Received: by 2002:a17:906:8a52:b0:9a1:cbe4:d029 with SMTP id gx18-20020a1709068a5200b009a1cbe4d029mr246573ejc.74.1693931080970; Tue, 05 Sep 2023 09:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693931080; cv=none; d=google.com; s=arc-20160816; b=yCIGB6IUJ4QF7qc55XtmnXzu9N16I0gtSN0RwkKOVrgSugO+zAhEU3gQQnrFkg1e3T 3oq8mvEW9ojDssbDp3GDshddFAX7gu2VCoE5yfogRmn0Kgs3rpYeEGqyOu7a363upZZi n5t6c0pJv5z2y5pOX0QLmC8kQOY166rbX1dg7PvEyJrUXxIPj2G3A6jBHXjqgFEvXbAt dqCm/OMNqOMrrqUrGy9cwKjBjh7FAIolo3OS8/OTbXt76AmOoOTjNZ1x/p5Uh03VG5rZ r2JUGZPshdeYuItlgbWfWNpl5DyFYwK/0e5KDIIxeG0cTaGY939MJw9p7NZlzLLfa6ZK dLbg== 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 :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :from; bh=+U/JiOjkbRbhLfDSKQi0ymooiDQuVaSUVdddyzFJFok=; fh=gc99MJTwDLBvfpxj84wTYmIGrahOZX6ZR+3r2P34hpQ=; b=O+XVm8SZtB4IGLabiNs7sDNDCyauZJTTJw/PUb7yMO9l32I4l0GuYrk/NuRzjuLjOR wX1AjIbEDw1fBoryLVNQj8uPFWoBv5pT4IJC5zPZr3D0OLiJ296Rt1gYCyW7kz7ycuj7 7f6fYgnqV1bVT0kEang4UdCZ3WhBaohyvXIjXXNXTVLYkxxml8lNwKmb5Q6cnSTGlP+x 0Mxi3UrW7wMTh7rC8nN6lfCtTVrVa50CUN+z+BTJ5YZR7P+NmrfN07Lc0ovPgc3paZNO 3D3hPDbscMESSeTWFQMk4+gCJmk+uMMCW4OqxGsTKpw9VpOYpYVlxv7E/8xT1CHBlMG8 b7TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=RhNQ8t2W; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a170906410900b0099bc0da5048si7785228ejk.376.2023.09.05.09.24.30; Tue, 05 Sep 2023 09:24:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=RhNQ8t2W; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241444AbjIALBu (ORCPT + 40 others); Fri, 1 Sep 2023 07:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232230AbjIALBt (ORCPT ); Fri, 1 Sep 2023 07:01:49 -0400 Received: from mail.toke.dk (mail.toke.dk [IPv6:2a0c:4d80:42:2001::664]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D41E10D5 for ; Fri, 1 Sep 2023 04:01:46 -0700 (PDT) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1693566104; bh=1WQne8zuae/eWhLZP5alO9Rk6xUCNACmkxspWqiFgZQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RhNQ8t2Whmybv9Op9unzIp0qzNMKa9ihVDo6T7OSj5zPWmgbGLcIuUoPnHu4J5/De n1KxLOo05vDq+tbMQdRdt4b/vN02Bywv7KhtjjgamV9SLl0LUcHcB+ty3VOAd1clwO DZktY7ILVJ9Va/wAhLjtW9RuXcxOQZUKlpcJT+MKPeboEH/H+BazEgTFs4wFpoLpXf 2G9FGIs4hk2UaXlVIqRWKTjmBd4gFLUX+dvXeqsYEpmRASvN4TqjH64yv3W9uJWwxQ 8puU+2qjZHLk7uByWaSTBPQKCUd4I7IuRSqWaExeKpaWAPYyv3Pt8XKt7XZMY6YCnB 8EtIoQleOPDeA== To: Dmitry Antipov Cc: Kalle Valo , linux-wireless@vger.kernel.org, Dmitry Antipov Subject: Re: [PATCH] wifi: ath9k: fix clang-specific fortify warnings In-Reply-To: <20230829093856.234584-1-dmantipov@yandex.ru> References: <20230829093856.234584-1-dmantipov@yandex.ru> Date: Fri, 01 Sep 2023 13:01:44 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87ledqtaw7.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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-wireless@vger.kernel.org Dmitry Antipov writes: > When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=3Dy, 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_overflow= 2_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_overflow= 2_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=C3=B8iland-J=C3=B8rgensen