2023-02-25 12:15:34

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH] zram: Use atomic_long_read() to read atomic_long_t

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; [email protected]
Fixes: b7d89654a988a2a4 ("zram: show zsmalloc objs_moved stat in mm_stat")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/block/zram/zram_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 3194e9254c6f3a04..8fff358c9cbace17 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1221,7 +1221,7 @@ static ssize_t mm_stat_show(struct device *dev,
max_used = atomic_long_read(&zram->stats.max_used_pages);

ret = scnprintf(buf, PAGE_SIZE,
- "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8llu\n",
+ "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8lu\n",
orig_size << PAGE_SHIFT,
(u64)atomic64_read(&zram->stats.compr_data_size),
mem_used << PAGE_SHIFT,
@@ -1231,7 +1231,7 @@ static ssize_t mm_stat_show(struct device *dev,
atomic_long_read(&pool_stats.pages_compacted),
(u64)atomic64_read(&zram->stats.huge_pages),
(u64)atomic64_read(&zram->stats.huge_pages_since),
- (u64)atomic64_read(&pool_stats.objs_moved));
+ atomic_long_read(&pool_stats.objs_moved));
up_read(&zram->init_lock);

return ret;
--
2.34.1



2023-02-26 03:38:17

by Sergey Senozhatsky

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

On (23/02/25 13:15), Geert Uytterhoeven 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.

Hi Geert,
The patch that cause the warning probably will be droppped from
the series in v3.

2023-02-26 04:31:03

by Andrew Morton

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

On Sat, 25 Feb 2023 13:15:23 +0100 Geert Uytterhoeven <[email protected]> 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; [email protected]

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.



2023-02-26 04:57:56

by Andrew Morton

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

On Sat, 25 Feb 2023 20:30:52 -0800 Andrew Morton <[email protected]> wrote:

> > Fix this by using atomic_long_read() instead.
> >
> > Reported-by; [email protected]
>
> 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.

I found this, and added it to the changelog:

Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/


2023-02-26 09:46:01

by Geert Uytterhoeven

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

Hi Andrew,

On Sun, Feb 26, 2023 at 5:57 AM Andrew Morton <[email protected]> wrote:
> On Sat, 25 Feb 2023 20:30:52 -0800 Andrew Morton <[email protected]> wrote:
> > > Fix this by using atomic_long_read() instead.
> > >
> > > Reported-by; [email protected]
> >
> > That's an interesting one. Was this mpe@?

No, from the kisskb build bot, which sends private emails to the
architecture maintainers when one of their builds fail:

----8<-------------------------------------------------------------------------------------------
Subject: kisskb: FAILED linux-next/m68k-defconfig/m68k-gcc8 Sat Feb 25, 14:34
From: [email protected]
To: [email protected]
Date: Sat, 25 Feb 2023 03:35:59 -0000
Message-ID: <20230225033559.1.93322@37da20578230>

FAILED linux-next/m68k-defconfig/m68k-gcc8 Sat Feb 25, 14:34

http://kisskb.ellerman.id.au/kisskb/buildresult/14885627/

Commit: Add linux-next specific files for 20230225
8232539f864ca60474e38eb42d451f5c26415856
Compiler: m68k-linux-gcc (GCC) 8.5.0 / GNU ld (GNU Binutils) 2.36.1

Possible errors
---------------

drivers/block/zram/zram_drv.c:1234:23: error: passing argument 1 of
'atomic64_read' from incompatible pointer type
[-Werror=incompatible-pointer-types]
cc1: some warnings being treated as errors
make[5]: *** [scripts/Makefile.build:252: drivers/block/zram/zram_drv.o] Error 1
make[4]: *** [scripts/Makefile.build:494: drivers/block/zram] Error 2
make[3]: *** [scripts/Makefile.build:494: drivers/block] Error 2
make[2]: *** [scripts/Makefile.build:494: drivers] Error 2
make[1]: *** [Makefile:2028: .] Error 2
make: *** [Makefile:226: __sub-make] Error 2

Possible warnings (1)
----------------------

include/linux/list.h:74:12: warning: 'seed_devices' may be used
uninitialized in this function [-Wmaybe-uninitialized]
------------------------------------------------------------------------------------------>8-----

> > I like it when a Reported-by: is followed by a Link: to the report, so
> > I can go hunt down such things.
>
> I found this, and added it to the changelog:
>
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

That's a different bot ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds