Subject: Re: [PATCH] sched/debug: fix noderef.cocci warnings

From: Valentin Schneider <[email-masked]>
Date: Wed, 12 Aug 2020 19:52:07 +0100

On 12/08/20 18:59, kernel test robot wrote:
> From: kernel test robot <[email-masked]>
>
> kernel/sched/debug.c:272:30-36: ERROR: application of sizeof to pointer
>
>  sizeof when applied to a pointer typed expression gives the size of
>  the pointer
>
> Generated by: scripts/coccinelle/misc/noderef.cocci
>
> CC: Valentin Schneider <[email-masked]>
> Signed-off-by: kernel test robot <[email-masked]>
> ---
>
> url:    https://github.com/0day-ci/linux/commits/Valentin-Schneider/sched-Instrument-sched-domain-flags/20200812-205638
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 949bcb8135a96a6923e676646bd29cbe69e8350f
>
>  debug.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -269,7 +269,7 @@ static int sd_ctl_doflags(struct ctl_tab
>               return 0;
>       }
>
> -	tmp = kcalloc(data_size + 1, sizeof(tmp), GFP_KERNEL);
> +	tmp = kcalloc(data_size + 1, sizeof(*tmp), GFP_KERNEL);

Praised be coccinelle for rubbing in my face that I can't write code; also
I'm not even checking if the allocation succeeded which is clearly daft,
even if this is debug stuff. I'll blame the heat and try to move on...

>       for_each_set_bit(idx, &flags, __SD_FLAG_CNT) {
>               char *name = sd_flag_debug[idx].name;
>

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel