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]
Message-ID: <1722480146-22924-1-git-send-email-zhiguo.niu@unisoc.com>
Date: Thu, 1 Aug 2024 10:42:26 +0800
From: Zhiguo Niu <zhiguo.niu@...soc.com>
To: <axboe@...nel.dk>, <dlemoal@...nel.org>, <hch@....de>
CC: <bvanassche@....org>, <linux-block@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <niuzhiguo84@...il.com>,
        <zhiguo.niu@...soc.com>, <ke.wang@...soc.com>,
        <Hao_hao.Wang@...soc.com>
Subject: [PATCH V4] block: uapi: Use unsigned int type for IOPRIO_PRIO_MASK

An ioprio is passed internally as an int value. When IOPRIO_PRIO_CLASS()
and IOPRIO_PRIO_LEVEL() are used to extract from it the priority class
and level,the values obtained are thus also int.
However, the IOPRIO_PRIO_MASK() macro used to define the IOPRIO_PRIO_DATA()
macro is defined as:

 #define IOPRIO_PRIO_MASK        ((1UL << IOPRIO_CLASS_SHIFT) - 1)

that is, the macro gives an unsigned long value, which leads to
IOPRIO_PRIO_DATA() also returning an unsigned long.

Make things consistent between class, level and data and use int everywhere
by removing forced unsigned long from IOPRIO_PRIO_MASK.

Fixes: 06447ae5e33b ("ioprio: move user space relevant ioprio bits to UAPI includes")
Cc: stable@...r.kernel.org
Cc: Oliver Hartkopp <socketcan@...tkopp.net>
Suggested-by: Damien Le Moal <dlemoal@...nel.org>
Reviewed-by: Bart Van Assche <bvanassche@....org>
Link: https://lore.kernel.org/all/1717155071-20409-1-git-send-email-zhiguo.niu@unisoc.com
Signed-off-by: Zhiguo Niu <zhiguo.niu@...soc.com>
---
v4: modify commit message Suggested by Damien Le Moal
v3: modify commit message according to Damien Le Moal's suggestion
v2: add Fixes tag and Cc tag
---
---
 include/uapi/linux/ioprio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/ioprio.h b/include/uapi/linux/ioprio.h
index bee2bdb0..9ead07f 100644
--- a/include/uapi/linux/ioprio.h
+++ b/include/uapi/linux/ioprio.h
@@ -11,7 +11,7 @@
 #define IOPRIO_CLASS_SHIFT	13
 #define IOPRIO_NR_CLASSES	8
 #define IOPRIO_CLASS_MASK	(IOPRIO_NR_CLASSES - 1)
-#define IOPRIO_PRIO_MASK	((1UL << IOPRIO_CLASS_SHIFT) - 1)
+#define IOPRIO_PRIO_MASK	((1U << IOPRIO_CLASS_SHIFT) - 1)
 
 #define IOPRIO_PRIO_CLASS(ioprio)	\
 	(((ioprio) >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK)
-- 
1.9.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ