diff mbox series

[9/9] iomap: use an unsigned type for IOMAP_DIO_* defines

Message ID 20230721161650.319414-10-axboe@kernel.dk (mailing list archive)
State Deferred, archived
Headers show
Series Improve async iomap DIO performance | expand

Commit Message

Jens Axboe July 21, 2023, 4:16 p.m. UTC
IOMAP_DIO_DIRTY shifts by 31 bits, which makes UBSAN unhappy. Clean up
all the defines by making the shifted value an unsigned value.

Reported-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/iomap/direct-io.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Darrick J. Wong July 21, 2023, 4:29 p.m. UTC | #1
On Fri, Jul 21, 2023 at 10:16:50AM -0600, Jens Axboe wrote:
> IOMAP_DIO_DIRTY shifts by 31 bits, which makes UBSAN unhappy. Clean up
> all the defines by making the shifted value an unsigned value.
> 
> Reported-by: Darrick J. Wong <djwong@kernel.org>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>

Thanks!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/iomap/direct-io.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
> index ae9046d16d71..dc9fe2ac9136 100644
> --- a/fs/iomap/direct-io.c
> +++ b/fs/iomap/direct-io.c
> @@ -20,12 +20,12 @@
>   * Private flags for iomap_dio, must not overlap with the public ones in
>   * iomap.h:
>   */
> -#define IOMAP_DIO_CALLER_COMP	(1 << 26)
> -#define IOMAP_DIO_INLINE_COMP	(1 << 27)
> -#define IOMAP_DIO_WRITE_THROUGH	(1 << 28)
> -#define IOMAP_DIO_NEED_SYNC	(1 << 29)
> -#define IOMAP_DIO_WRITE		(1 << 30)
> -#define IOMAP_DIO_DIRTY		(1 << 31)
> +#define IOMAP_DIO_CALLER_COMP	(1U << 26)
> +#define IOMAP_DIO_INLINE_COMP	(1U << 27)
> +#define IOMAP_DIO_WRITE_THROUGH	(1U << 28)
> +#define IOMAP_DIO_NEED_SYNC	(1U << 29)
> +#define IOMAP_DIO_WRITE		(1U << 30)
> +#define IOMAP_DIO_DIRTY		(1U << 31)
>  
>  struct iomap_dio {
>  	struct kiocb		*iocb;
> -- 
> 2.40.1
>
Christoph Hellwig July 24, 2023, 4:36 p.m. UTC | #2
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index ae9046d16d71..dc9fe2ac9136 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -20,12 +20,12 @@ 
  * Private flags for iomap_dio, must not overlap with the public ones in
  * iomap.h:
  */
-#define IOMAP_DIO_CALLER_COMP	(1 << 26)
-#define IOMAP_DIO_INLINE_COMP	(1 << 27)
-#define IOMAP_DIO_WRITE_THROUGH	(1 << 28)
-#define IOMAP_DIO_NEED_SYNC	(1 << 29)
-#define IOMAP_DIO_WRITE		(1 << 30)
-#define IOMAP_DIO_DIRTY		(1 << 31)
+#define IOMAP_DIO_CALLER_COMP	(1U << 26)
+#define IOMAP_DIO_INLINE_COMP	(1U << 27)
+#define IOMAP_DIO_WRITE_THROUGH	(1U << 28)
+#define IOMAP_DIO_NEED_SYNC	(1U << 29)
+#define IOMAP_DIO_WRITE		(1U << 30)
+#define IOMAP_DIO_DIRTY		(1U << 31)
 
 struct iomap_dio {
 	struct kiocb		*iocb;