Skip to contentSkip to conversation

dm-pcache: fix warnings found by smatch

PATCH In review Dongsheng Yang 2 participants 4 messages Aug 19, 2025

Subsystems (2)
lore
Share & tools
lore

Dongsheng Yang

author maintainer
#0 lore raw

cover dm-pcache: fix warnings found by smatch

Hi Mikulas,
Please help to apply these two changes into dm-6.18.
It fixes two warnings found by smatch.

Thanx for the report from Dan.

Dongsheng Yang (2):
dm-pcache: fix uninitialized variable issue found by smatch
dm-pcache: fix an indenting issue found by smatch

 drivers/md/dm-pcache/cache_req.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/2 dm-pcache: fix uninitialized variable issue found by smatch

---
 drivers/md/dm-pcache/cache_req.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-pcache/cache_req.c +1 -1
index 992a1ad98909..e0b90bfea4fe 100644
@@ -45,6 +45,7 @@ static int cache_data_alloc(struct pcache_cache *cache, struct pcache_cache_key
 	preempt_disable();
 	data_head = get_data_head(cache);
 again:
+	to_alloc = key->len - allocated;
 	if (!data_head->head_pos.cache_seg) {
 		seg_remain = 0;
 	} else {
@@ -54,7 +55,6 @@ static int cache_data_alloc(struct pcache_cache *cache, struct pcache_cache_key
 		head_pos = &data_head->head_pos;
 		cache_seg = head_pos->cache_seg;
 		seg_remain = cache_seg_remain(head_pos);
-		to_alloc = key->len - allocated;
 	}
 
 	if (seg_remain > to_alloc) {
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/2 dm-pcache: fix an indenting issue found by smatch

In reply to Dongsheng Yang
---
 drivers/md/dm-pcache/cache_req.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-pcache/cache_req.c +1 -1
index e0b90bfea4fe..bd5cace7de71 100644
@@ -298,7 +298,7 @@ static struct pcache_backing_dev_req *get_pre_alloc_req(struct pcache_cache_subt
 		return backing_req;
 	}
 
-       return cache_miss_req_alloc(cache, pcache_req, GFP_NOWAIT);
+	return cache_miss_req_alloc(cache, pcache_req, GFP_NOWAIT);
 }
 
 /*
Signature · 1 line
2.43.0
maintainer
#3 lore raw
In reply to Dongsheng Yang
Quoted 4 lines · Dongsheng Yang

Hi Mikulas,
Please help to apply these two changes into dm-6.18.
It fixes two warnings found by smatch.

Quoted 11 lines

Thanx for the report from Dan.

Dongsheng Yang (2):
dm-pcache: fix uninitialized variable issue found by smatch
dm-pcache: fix an indenting issue found by smatch

 drivers/md/dm-pcache/cache_req.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0

Thanks. I folded them into the existing patch.

Mikulas