diff mbox series

[V2] block: uapi: Fix compliation warning of using IOPRIO_PRIO_DATA

Message ID 1720518712-28301-1-git-send-email-zhiguo.niu@unisoc.com (mailing list archive)
State New, archived
Headers show
Series [V2] block: uapi: Fix compliation warning of using IOPRIO_PRIO_DATA | expand

Commit Message

Zhiguo Niu July 9, 2024, 9:51 a.m. UTC
Generally, the input of IOPRIO_PRIO_DATA has 16 bits. If use format "%d"
to printk IOPRIO_PRIO_DATA, there will be the following warning or error.

fs/f2fs/sysfs.c:348:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
   return sysfs_emit(buf, "%s,%d\n",
                              ~^
                              %ld

This is because the output of IOPRIO_PRIO_DATA is converted to "UL" from
IOPRIO_PRIO_MASK, which is not reasonable. unsigned int is more suitable.

Fixes: 06447ae5e33b ("ioprio: move user space relevant ioprio bits to UAPI includes")
Cc: stable@vger.kernel.org
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/all/1717155071-20409-1-git-send-email-zhiguo.niu@unisoc.com
---
v2: add Fixes tag and Cc tag
---
---
 include/uapi/linux/ioprio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhiguo Niu July 16, 2024, 9:28 a.m. UTC | #1
kindly ping...

Zhiguo Niu <zhiguo.niu@unisoc.com> 于2024年7月9日周二 17:52写道:
>
> Generally, the input of IOPRIO_PRIO_DATA has 16 bits. If use format "%d"
> to printk IOPRIO_PRIO_DATA, there will be the following warning or error.
>
> fs/f2fs/sysfs.c:348:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
>    return sysfs_emit(buf, "%s,%d\n",
>                               ~^
>                               %ld
>
> This is because the output of IOPRIO_PRIO_DATA is converted to "UL" from
> IOPRIO_PRIO_MASK, which is not reasonable. unsigned int is more suitable.
>
> Fixes: 06447ae5e33b ("ioprio: move user space relevant ioprio bits to UAPI includes")
> Cc: stable@vger.kernel.org
> Cc: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> Link: https://lore.kernel.org/all/1717155071-20409-1-git-send-email-zhiguo.niu@unisoc.com
> ---
> 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
>
Bart Van Assche July 16, 2024, 8:03 p.m. UTC | #2
On 7/16/24 2:28 AM, Zhiguo Niu wrote:
> kindly ping...

Please repost this patch after the merge window has closed.

Thanks,

Bart.
diff mbox series

Patch

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)