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>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Sep 2019 11:38:28 +0100
From:   Alessio Balsini <balsini@...roid.com>
To:     linux-block@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, kernel-team@...roid.com,
        Alessio Balsini <balsini@...roid.com>,
        Jens Axboe <axboe@...nel.dk>
Subject: [PATCH] block: Fix implicit unsigned to signed conversion

An unsigned integer variable may be assigned negative values, and is
returned by the function with an implicit conversion to signed.  Besides
the implicit conversion at return time for which the variable
representation is fine and there is no variable manipulation that may
lead to bugs in the current code base, this is a conceptual error.

Fix by changing the variable type from unsigned to signed.

Signed-off-by: Alessio Balsini <balsini@...roid.com>
Cc: Jens Axboe <axboe@...nel.dk>
---
 block/blk-settings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 6bd1e3b082d8..c76c25c45869 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -496,7 +496,8 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
 int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 		     sector_t start)
 {
-	unsigned int top, bottom, alignment, ret = 0;
+	unsigned int top, bottom, alignment;
+	int ret = 0;
 
 	t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
 	t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);
-- 
2.23.0.237.gc6a4ce50a0-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ