lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri,  4 Sep 2015 12:50:59 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Kent Overstreet <kent.overstreet@...il.com>,
	Jens Axboe <axboe@...com>, Joern Engel <joern@...fs.org>,
	Prasad Joshi <prasadjoshi.linux@...il.com>
Cc:	logfs@...fs.org, linux-kernel@...r.kernel.org,
	Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH] logfs: Use min_t() to compare different types

fs/logfs/dev_bdev.c: In function ‘__bdev_writeseg’:
fs/logfs/dev_bdev.c:84: warning: comparison of distinct pointer types lacks a cast
fs/logfs/dev_bdev.c: In function ‘do_erase’:
fs/logfs/dev_bdev.c:174: warning: comparison of distinct pointer types lacks a cast

Until b54ffb73cadcdcff ("block: remove bio_get_nr_vecs()") there were
explicit casts to "size_t" to avoid compiler warnings.  Use
"min_t(size_t, ...)" instead.

Fixes: b54ffb73cadcdcff ("block: remove bio_get_nr_vecs()").
Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
The nearby code desperately needs some int/unsigned int/size_t cleanups
(e.g. an "int" loop counter with a "size_t" limit?).
---
 fs/logfs/dev_bdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index a7fdbd86847453ac..a709d80c8ebcc783 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -81,7 +81,7 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
 	unsigned int max_pages;
 	int i;
 
-	max_pages = min(nr_pages, BIO_MAX_PAGES);
+	max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);
 
 	bio = bio_alloc(GFP_NOFS, max_pages);
 	BUG_ON(!bio);
@@ -171,7 +171,7 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
 	unsigned int max_pages;
 	int i;
 
-	max_pages = min(nr_pages, BIO_MAX_PAGES);
+	max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);
 
 	bio = bio_alloc(GFP_NOFS, max_pages);
 	BUG_ON(!bio);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ