All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] dax: silence an uninitialized variable warning
@ 2016-03-22 11:38 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-03-22 11:38 UTC (permalink / raw)
  To: Alexander Viro, Dan Williams
  Cc: Matthew Wilcox, linux-fsdevel, kernel-janitors

I'm not positive, but it looks like it might be possible to reach the
end of this function and return an uninitialized value for "rc".  Anyway
it causes a static checker warning and let's silence it.

The warning was introduced in commit b2e0d1625e19 ('dax: fix lifetime of
in-kernel dax mappings with dax_map_atomic()').

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/dax.c b/fs/dax.c
index 90322eb..3744e14 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -155,7 +155,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 	loff_t pos = start, max = start, bh_max = start;
 	bool hole = false, need_wmb = false;
 	struct block_device *bdev = NULL;
-	int rw = iov_iter_rw(iter), rc;
+	int rc = 0;
+	int rw = iov_iter_rw(iter);
 	long map_len = 0;
 	struct blk_dax_ctl dax = {
 		.addr = (void __pmem *) ERR_PTR(-EIO),

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

* [patch] dax: silence an uninitialized variable warning
@ 2016-03-22 11:38 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-03-22 11:38 UTC (permalink / raw)
  To: Alexander Viro, Dan Williams
  Cc: Matthew Wilcox, linux-fsdevel, kernel-janitors

I'm not positive, but it looks like it might be possible to reach the
end of this function and return an uninitialized value for "rc".  Anyway
it causes a static checker warning and let's silence it.

The warning was introduced in commit b2e0d1625e19 ('dax: fix lifetime of
in-kernel dax mappings with dax_map_atomic()').

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/dax.c b/fs/dax.c
index 90322eb..3744e14 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -155,7 +155,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 	loff_t pos = start, max = start, bh_max = start;
 	bool hole = false, need_wmb = false;
 	struct block_device *bdev = NULL;
-	int rw = iov_iter_rw(iter), rc;
+	int rc = 0;
+	int rw = iov_iter_rw(iter);
 	long map_len = 0;
 	struct blk_dax_ctl dax = {
 		.addr = (void __pmem *) ERR_PTR(-EIO),

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

* Re: [patch] dax: silence an uninitialized variable warning
  2016-03-22 11:38 ` Dan Carpenter
@ 2016-03-22 17:26   ` Jeff Moyer
  -1 siblings, 0 replies; 4+ messages in thread
From: Jeff Moyer @ 2016-03-22 17:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alexander Viro, Dan Williams, Matthew Wilcox, linux-fsdevel,
	kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> writes:

> I'm not positive, but it looks like it might be possible to reach the
> end of this function and return an uninitialized value for "rc".  Anyway
> it causes a static checker warning and let's silence it.
>
> The warning was introduced in commit b2e0d1625e19 ('dax: fix lifetime of
> in-kernel dax mappings with dax_map_atomic()').
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Looks good to me.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

>
> diff --git a/fs/dax.c b/fs/dax.c
> index 90322eb..3744e14 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -155,7 +155,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
>  	loff_t pos = start, max = start, bh_max = start;
>  	bool hole = false, need_wmb = false;
>  	struct block_device *bdev = NULL;
> -	int rw = iov_iter_rw(iter), rc;
> +	int rc = 0;
> +	int rw = iov_iter_rw(iter);
>  	long map_len = 0;
>  	struct blk_dax_ctl dax = {
>  		.addr = (void __pmem *) ERR_PTR(-EIO),
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] dax: silence an uninitialized variable warning
@ 2016-03-22 17:26   ` Jeff Moyer
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Moyer @ 2016-03-22 17:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alexander Viro, Dan Williams, Matthew Wilcox, linux-fsdevel,
	kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> writes:

> I'm not positive, but it looks like it might be possible to reach the
> end of this function and return an uninitialized value for "rc".  Anyway
> it causes a static checker warning and let's silence it.
>
> The warning was introduced in commit b2e0d1625e19 ('dax: fix lifetime of
> in-kernel dax mappings with dax_map_atomic()').
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Looks good to me.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

>
> diff --git a/fs/dax.c b/fs/dax.c
> index 90322eb..3744e14 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -155,7 +155,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
>  	loff_t pos = start, max = start, bh_max = start;
>  	bool hole = false, need_wmb = false;
>  	struct block_device *bdev = NULL;
> -	int rw = iov_iter_rw(iter), rc;
> +	int rc = 0;
> +	int rw = iov_iter_rw(iter);
>  	long map_len = 0;
>  	struct blk_dax_ctl dax = {
>  		.addr = (void __pmem *) ERR_PTR(-EIO),
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-03-22 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 11:38 [patch] dax: silence an uninitialized variable warning Dan Carpenter
2016-03-22 11:38 ` Dan Carpenter
2016-03-22 17:26 ` Jeff Moyer
2016-03-22 17:26   ` Jeff Moyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.