mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] udf: Initialize newblock variable COVERITY: 1530250
@ 2022-12-26 18:57 Tanmay Bhushan
  2023-01-02 12:53 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Tanmay Bhushan @ 2022-12-26 18:57 UTC (permalink / raw)
  To: Jan Kara, linux-kernel

From 21f30c35ba12c939da0990a8527790408276aaee Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <007047221b@gmail.com>
Date: Mon, 26 Dec 2022 18:54:13 +0100
Subject: [PATCH] udf: Initialize newblock variable COVERITY: 1530250

When getting newblock the variable returned is not initialized.
Coverity informs this as a high risk impact because variable may
contain an arbitrary value left from earlier computations. Newblock
is initialized to avoid this issue.

Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
---
 fs/udf/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 1d7c2a812fc1..71bc4de38ad2 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -684,7 +684,7 @@ static sector_t inode_getblk(struct inode *inode,
sector_t block,
 	struct kernel_lb_addr eloc, tmpeloc;
 	int c = 1;
 	loff_t lbcount = 0, b_off = 0;
-	udf_pblk_t newblocknum, newblock;
+	udf_pblk_t newblocknum, newblock = 0;
 	sector_t offset = 0;
 	int8_t etype;
 	struct udf_inode_info *iinfo = UDF_I(inode);
-- 
2.34.1



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

* Re: [PATCH] udf: Initialize newblock variable COVERITY: 1530250
  2022-12-26 18:57 [PATCH] udf: Initialize newblock variable COVERITY: 1530250 Tanmay Bhushan
@ 2023-01-02 12:53 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2023-01-02 12:53 UTC (permalink / raw)
  To: Tanmay Bhushan; +Cc: Jan Kara, linux-kernel

On Mon 26-12-22 19:57:00, Tanmay Bhushan wrote:
> From 21f30c35ba12c939da0990a8527790408276aaee Mon Sep 17 00:00:00 2001
> From: Tanmay Bhushan <007047221b@gmail.com>
> Date: Mon, 26 Dec 2022 18:54:13 +0100
> Subject: [PATCH] udf: Initialize newblock variable COVERITY: 1530250
> 
> When getting newblock the variable returned is not initialized.
> Coverity informs this as a high risk impact because variable may
> contain an arbitrary value left from earlier computations. Newblock
> is initialized to avoid this issue.
> 
> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>

Thanks for the fix. Somehow the patch is corrupted so I couldn't apply it.
I had also other people send me this fix (which I've applied) so no need to
resend this particular patch but it would be good to fix your setup so that
you can send valid patches... Thanks!

									Honza

> ---
>  fs/udf/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 1d7c2a812fc1..71bc4de38ad2 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -684,7 +684,7 @@ static sector_t inode_getblk(struct inode *inode,
> sector_t block,
>  	struct kernel_lb_addr eloc, tmpeloc;
>  	int c = 1;
>  	loff_t lbcount = 0, b_off = 0;
> -	udf_pblk_t newblocknum, newblock;
> +	udf_pblk_t newblocknum, newblock = 0;
>  	sector_t offset = 0;
>  	int8_t etype;
>  	struct udf_inode_info *iinfo = UDF_I(inode);
> -- 
> 2.34.1
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2023-01-02 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 18:57 [PATCH] udf: Initialize newblock variable COVERITY: 1530250 Tanmay Bhushan
2023-01-02 12:53 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®