Linux wireless drivers development
 help / color / mirror / Atom feed
From: Christian Lamparter <chunkeey@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: ansuelsmth@gmail.com, jirislaby@kernel.org, kvalo@kernel.org,
	mcgrof@kernel.org, mickflemm@gmail.com, robimarko@gmail.com,
	toke@toke.dk, yangshiji66@qq.com,
	Shiji Yang <yangshiji66@outlook.com>
Subject: Re: [PATCH] wifi: ath: add struct_group for struct ath_cycle_counters
Date: Sun, 4 Jun 2023 13:11:41 +0200	[thread overview]
Message-ID: <582d6f32-23f8-6175-19da-f0b4c97393f5@gmail.com> (raw)
In-Reply-To: <TYAP286MB0315FA0080ABAE79CC842899BC4CA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM>

On 6/4/23 03:48, Shiji Yang wrote:
> Thank you all,
> This patch may not look so beautiful, but its main purpose is to raise
> some awareness about this strange compilation warning.
> 
> This problem only occurs in mips gcc 12.3 (maybe only on arc mips/ath79).

It also occures with PPC464/APM82181. Could it be that that it occurs on
"big-endian" archs?


> In:
> 
>> --- a/drivers/net/wireless/ath/ath9k/main.c
>> +++ b/drivers/net/wireless/ath/ath9k/main.c
>> @@ -135,8 +135,8 @@ void ath9k_ps_wakeup(struct ath_softc *sc)
>> 	if (power_mode != ATH9K_PM_AWAKE) {
>> 		spin_lock(&common->cc_lock);
>> 		ath_hw_cycle_counters_update(common);
>> -		memset(&common->cc_survey, 0, sizeof(common->cc_survey));
>> -		memset(&common->cc_ani, 0, sizeof(common->cc_ani));
>> +		memset(&common->cc_survey.cnts, 0, sizeof(common->cc_survey.cnts));
>> +		memset(&common->cc_ani.cnts, 0, sizeof(common->cc_ani.cnts));
>> 		spin_unlock(&common->cc_lock);
>> 	}
> 
> The compiler will only warn the second memset() `memset(&common->cc_ani, 0, sizeof(common->cc_ani));`
> detected write beyond size of field. However, `cc_survey` and `cc_survey` are the same structure.
> I have no idea about this warning. I will be very grateful if someone can provide some tips or a
> better solution.
> 
> The full log:
> make[4]: Entering directory '/home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24'
> make[5]: 'Kconfig.versions' is up to date.
> make[7]: 'Kconfig.versions' is up to date.
> make[8]: 'conf' is up to date.
> boolean symbol CRYPTO_LIB_ARC4 tested for 'm'? test forced to 'n'
> #
> # configuration written to .config
> #
> Building backport-include/backport/autoconf.h ... done.
>    CC [M]  /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.o
> In file included from ./include/linux/string.h:253,
>                   from /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/backport-include/linux/string.h:3,
>                   from ./include/linux/bitmap.h:11,
>                   from ./include/linux/cpumask.h:12,
>                   from ./arch/mips/include/asm/processor.h:15,
>                   from ./arch/mips/include/asm/thread_info.h:16,
>                   from ./include/linux/thread_info.h:60,
>                   from ./include/asm-generic/current.h:5,
>                   from ./arch/mips/include/generated/asm/current.h:1,
>                   from ./include/linux/sched.h:12,
>                   from /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/backport-include/linux/sched.h:4,
>                   from ./include/linux/delay.h:23,
>                   from /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/backport-include/linux/delay.h:3,
>                   from /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.c:18:
> In function 'fortify_memset_chk',
>      inlined from 'ath9k_ps_wakeup' at /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.c:140:3:
> ./include/linux/fortify-string.h:314:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
>    314 |                         __write_overflow_field(p_size_field, size);
>        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[11]: *** [scripts/Makefile.build:250: /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless/ath/ath9k/main.o] Error 1
> make[10]: *** [scripts/Makefile.build:500: /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless/ath/ath9k] Error 2
> make[9]: *** [scripts/Makefile.build:500: /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless/ath] Error 2
> make[8]: *** [scripts/Makefile.build:500: /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/drivers/net/wireless] Error 2
> make[7]: *** [Makefile:2012: /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24] Error 2
> make[6]: *** [Makefile.build:13: modules] Error 2
> make[5]: *** [Makefile.real:93: modules] Error 2
> make[4]: *** [Makefile:121: modules] Error 2
> make[4]: Leaving directory '/home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24'
> make[3]: *** [Makefile:401: /home/db/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_nand/backports-6.1.24/.built] Error 2
> make[3]: Leaving directory '/home/db/openwrt/package/kernel/mac80211'
> time: package/kernel/mac80211/regular/compile#4.94#0.95#21.75
>      ERROR: package/kernel/mac80211 failed to build (build variant: regular).
> make[2]: *** [package/Makefile:120: package/kernel/mac80211/compile] Error 1
> make[2]: Leaving directory '/home/db/openwrt'
> make[1]: *** [package/Makefile:114: /home/db/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
> make[1]: Leaving directory '/home/db/openwrt'
> make: *** [/home/db/openwrt/include/toplevel.mk:231: world] Error 2
> 
> Best Regards,
> Shiji Yang


  reply	other threads:[~2023-06-04 11:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02  4:36 [PATCH] wifi: ath: add struct_group for struct ath_cycle_counters Shiji Yang
2023-06-02  4:58 ` Jiri Slaby
2023-06-02  5:19   ` Kalle Valo
2023-06-04  1:46     ` Shiji Yang
2023-06-04  1:40   ` Shiji Yang
2023-06-04  1:48 ` Shiji Yang
2023-06-04 11:11   ` Christian Lamparter [this message]
2023-06-05  6:00     ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=582d6f32-23f8-6175-19da-f0b4c97393f5@gmail.com \
    --to=chunkeey@gmail.com \
    --cc=ansuelsmth@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mickflemm@gmail.com \
    --cc=robimarko@gmail.com \
    --cc=toke@toke.dk \
    --cc=yangshiji66@outlook.com \
    --cc=yangshiji66@qq.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox