Skip to contentSkip to conversation

udf: Initialize newblock variable COVERITY: 1530250

PATCH In review Tanmay Bhushan 2 participants 2 messages Dec 26, 2022 – Jan 2, 2023 UDF filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udf: Initialize newblock variable COVERITY: 1530250

From 21f30c35ba12c939da0990a8527790408276aaee Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <[email protected]>
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.

---
 fs/udf/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/inode.c +0 -0
index 1d7c2a812fc1..71bc4de38ad2 100644
@@ -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);

Signature · 1 line
2.34.1
#1 lore raw
Quoted 11 lines · Tanmay Bhushan

From 21f30c35ba12c939da0990a8527790408276aaee Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <[email protected]>
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.

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

Quoted 22 lines
---
 fs/udf/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/inode.c +1 -1
index 1d7c2a812fc1..71bc4de38ad2 100644
@@ -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);

Signature · 1 line
2.34.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR