fs : Fix warning using plain integer as NULL
authorAbhinav Singh <singhabhinav9051571833@gmail.com>
Wed, 8 Nov 2023 04:45:50 +0000 (10:15 +0530)
committerChristian Brauner <brauner@kernel.org>
Sat, 18 Nov 2023 14:00:01 +0000 (15:00 +0100)
Sparse static analysis tools generate a warning with this message
"Using plain integer as NULL pointer". In this case this warning is
being shown because we are trying to initialize  pointer to NULL using
integer value 0.

Signed-off-by: Abhinav Singh <singhabhinav9051571833@gmail.com>
Link: https://lore.kernel.org/r/20231108044550.1006555-1-singhabhinav9051571833@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/dax.c
fs/direct-io.c

index 3380b43cb6bbbd1289901a3e29edc903abe6156e..423fc1607dfae5bfda9acb7042acb408e187823c 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1128,7 +1128,7 @@ static int dax_iomap_copy_around(loff_t pos, uint64_t length, size_t align_size,
        /* zero the edges if srcmap is a HOLE or IOMAP_UNWRITTEN */
        bool zero_edge = srcmap->flags & IOMAP_F_SHARED ||
                         srcmap->type == IOMAP_UNWRITTEN;
-       void *saddr = 0;
+       void *saddr = NULL;
        int ret = 0;
 
        if (!zero_edge) {
index 20533266ade6e5b097b023182d8b59f5d6e82e19..60456263a338e018e6b4cb0f79ce26e0806ec4c9 100644 (file)
@@ -1114,7 +1114,7 @@ ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
        loff_t offset = iocb->ki_pos;
        const loff_t end = offset + count;
        struct dio *dio;
-       struct dio_submit sdio = { 0, };
+       struct dio_submit sdio = { NULL, };
        struct buffer_head map_bh = { 0, };
        struct blk_plug plug;
        unsigned long align = offset | iov_iter_alignment(iter);