public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-next] io_uring: fix min types mismatch in table alloc
@ 2021-06-15 12:20 Pavel Begunkov
  2021-06-15 12:21 ` Pavel Begunkov
  2021-06-15 21:40 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Begunkov @ 2021-06-15 12:20 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Stephen Rothwell

fs/io_uring.c: In function 'io_alloc_page_table':
include/linux/minmax.h:20:28: warning: comparison of distinct pointer
	types lacks a cast

Cast everything to size_t using min_t.

Reported-by: Stephen Rothwell <[email protected]>
Fixes: 9123c8ffce16 ("io_uring: add helpers for 2 level table alloc")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 315fb5df5054..a06c07210696 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7089,7 +7089,7 @@ static void **io_alloc_page_table(size_t size)
 		return NULL;
 
 	for (i = 0; i < nr_tables; i++) {
-		unsigned int this_size = min(size, PAGE_SIZE);
+		unsigned int this_size = min_t(size_t, size, PAGE_SIZE);
 
 		table[i] = kzalloc(this_size, GFP_KERNEL);
 		if (!table[i]) {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-next] io_uring: fix min types mismatch in table alloc
  2021-06-15 12:20 [PATCH for-next] io_uring: fix min types mismatch in table alloc Pavel Begunkov
@ 2021-06-15 12:21 ` Pavel Begunkov
  2021-06-15 21:40 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Begunkov @ 2021-06-15 12:21 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Stephen Rothwell

On 6/15/21 1:20 PM, Pavel Begunkov wrote:
> fs/io_uring.c: In function 'io_alloc_page_table':
> include/linux/minmax.h:20:28: warning: comparison of distinct pointer
> 	types lacks a cast

Build issues are nasty. Jens, I'd guess you want to fold it in

> Cast everything to size_t using min_t.
> 
> Reported-by: Stephen Rothwell <[email protected]>
> Fixes: 9123c8ffce16 ("io_uring: add helpers for 2 level table alloc")
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
>  fs/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 315fb5df5054..a06c07210696 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -7089,7 +7089,7 @@ static void **io_alloc_page_table(size_t size)
>  		return NULL;
>  
>  	for (i = 0; i < nr_tables; i++) {
> -		unsigned int this_size = min(size, PAGE_SIZE);
> +		unsigned int this_size = min_t(size_t, size, PAGE_SIZE);
>  
>  		table[i] = kzalloc(this_size, GFP_KERNEL);
>  		if (!table[i]) {
> 

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-next] io_uring: fix min types mismatch in table alloc
  2021-06-15 12:20 [PATCH for-next] io_uring: fix min types mismatch in table alloc Pavel Begunkov
  2021-06-15 12:21 ` Pavel Begunkov
@ 2021-06-15 21:40 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-06-15 21:40 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: Stephen Rothwell

On 6/15/21 6:20 AM, Pavel Begunkov wrote:
> fs/io_uring.c: In function 'io_alloc_page_table':
> include/linux/minmax.h:20:28: warning: comparison of distinct pointer
> 	types lacks a cast
> 
> Cast everything to size_t using min_t.

Applied - didn't fold it in, it's just a warning.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-15 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-15 12:20 [PATCH for-next] io_uring: fix min types mismatch in table alloc Pavel Begunkov
2021-06-15 12:21 ` Pavel Begunkov
2021-06-15 21:40 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox