linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs : Fix warning using plain integer as NULL
@ 2023-11-08  4:45 Abhinav Singh
  2023-11-08 10:01 ` Christian Brauner
  2023-11-08 10:15 ` Jan Kara
  0 siblings, 2 replies; 5+ messages in thread
From: Abhinav Singh @ 2023-11-08  4:45 UTC (permalink / raw)
  To: viro, brauner, dan.j.williams, willy, jack
  Cc: linux-fsdevel, linux-kernel, nvdimm, linux-kernel-mentees,
	Abhinav Singh

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>
---
 fs/dax.c       | 2 +-
 fs/direct-io.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 3380b43cb6bb..423fc1607dfa 100644
--- 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) {
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 20533266ade6..60456263a338 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs : Fix warning using plain integer as NULL
  2023-11-08  4:45 [PATCH] fs : Fix warning using plain integer as NULL Abhinav Singh
@ 2023-11-08 10:01 ` Christian Brauner
  2023-11-08 10:15 ` Jan Kara
  1 sibling, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2023-11-08 10:01 UTC (permalink / raw)
  To: Abhinav Singh
  Cc: Christian Brauner, linux-fsdevel, linux-kernel, nvdimm,
	linux-kernel-mentees, viro, dan.j.williams, willy, jack

On Wed, 08 Nov 2023 10:15:50 +0530, Abhinav Singh wrote:
> 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.
> 
> 

Applied to the vfs.misc branch of the vfs/vfs.git tree.
Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/1] fs : Fix warning using plain integer as NULL
      https://git.kernel.org/vfs/vfs/c/372bfbd2ea43

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs : Fix warning using plain integer as NULL
  2023-11-08  4:45 [PATCH] fs : Fix warning using plain integer as NULL Abhinav Singh
  2023-11-08 10:01 ` Christian Brauner
@ 2023-11-08 10:15 ` Jan Kara
  2023-11-08 10:47   ` Abhinav Singh
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kara @ 2023-11-08 10:15 UTC (permalink / raw)
  To: Abhinav Singh
  Cc: viro, brauner, dan.j.williams, willy, jack, linux-fsdevel,
	linux-kernel, nvdimm, linux-kernel-mentees

On Wed 08-11-23 10:15:50, Abhinav Singh wrote:
> 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>

Nice cleanup. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>
								Honza

> ---
>  fs/dax.c       | 2 +-
>  fs/direct-io.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 3380b43cb6bb..423fc1607dfa 100644
> --- 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) {
> diff --git a/fs/direct-io.c b/fs/direct-io.c
> index 20533266ade6..60456263a338 100644
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -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);
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] fs : Fix warning using plain integer as NULL
  2023-11-08 10:15 ` Jan Kara
@ 2023-11-08 10:47   ` Abhinav Singh
  2023-11-08 10:50     ` Abhinav Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Abhinav Singh @ 2023-11-08 10:47 UTC (permalink / raw)
  To: viro, brauner, dan.j.williams, willy, jack
  Cc: linux-fsdevel, linux-kernel, nvdimm, linux-kernel-mentees,
	Abhinav Singh

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>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/dax.c       | 2 +-
 fs/direct-io.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 3380b43cb6bb..423fc1607dfa 100644
--- 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) {
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 20533266ade6..60456263a338 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fs : Fix warning using plain integer as NULL
  2023-11-08 10:47   ` Abhinav Singh
@ 2023-11-08 10:50     ` Abhinav Singh
  0 siblings, 0 replies; 5+ messages in thread
From: Abhinav Singh @ 2023-11-08 10:50 UTC (permalink / raw)
  To: viro, brauner, dan.j.williams, willy, jack
  Cc: linux-fsdevel, linux-kernel, nvdimm, linux-kernel-mentees

On 11/8/23 16:17, Abhinav Singh wrote:
> 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>
> Reviewed-by: Jan Kara <jack@suse.cz>
> ---
>   fs/dax.c       | 2 +-
>   fs/direct-io.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index 3380b43cb6bb..423fc1607dfa 100644
> --- 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) {
> diff --git a/fs/direct-io.c b/fs/direct-io.c
> index 20533266ade6..60456263a338 100644
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -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);
Thanks a lot  maintainers for looking into this patch and accepting this 
patch.

BR
Abhinav

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-08 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08  4:45 [PATCH] fs : Fix warning using plain integer as NULL Abhinav Singh
2023-11-08 10:01 ` Christian Brauner
2023-11-08 10:15 ` Jan Kara
2023-11-08 10:47   ` Abhinav Singh
2023-11-08 10:50     ` Abhinav Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).