Re: [PATCH] zram: Use atomic_long_read() to read atomic_long_t

From: Andrew Morton
Date: Sat Feb 25 2023 - 23:31:03 EST


On Sat, 25 Feb 2023 13:15:23 +0100 Geert Uytterhoeven <geert+renesas@xxxxxxxxx> wrote:

> On 32-bit:
>
> drivers/block/zram/zram_drv.c: In function ‘mm_stat_show’:
> drivers/block/zram/zram_drv.c:1234:23: error: passing argument 1 of ‘atomic64_read’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> 1234 | (u64)atomic64_read(&pool_stats.objs_moved));
> | ^~~~~~~~~~~~~~~~~~~~~~
> | |
> | atomic_long_t * {aka struct <anonymous> *}
> In file included from ./include/linux/atomic.h:82,
> from ./include/linux/mm_types_task.h:13,
> from ./include/linux/mm_types.h:5,
> from ./include/linux/buildid.h:5,
> from ./include/linux/module.h:14,
> from drivers/block/zram/zram_drv.c:18:
> ./include/linux/atomic/atomic-instrumented.h:644:33: note: expected ‘const atomic64_t *’ {aka ‘const struct <anonymous> *’} but argument is of type ‘atomic_long_t *’ {aka ‘struct <anonymous> *’}
> 644 | atomic64_read(const atomic64_t *v)
> | ~~~~~~~~~~~~~~~~~~^
>
> Fix this by using atomic_long_read() instead.
>
> Reported-by; noreply@xxxxxxxxxxxxxx

That's an interesting one. Was this mpe@?

I like it when a Reported-by: is followed by a Link: to the report, so
I can go hunt down such things.