Hello Matthew Sakai,

The patch 7d7084389ab3: "dm vdo: add flush support" from Nov 16, 2023
(linux-next), leads to the following Smatch static checker warning:

        drivers/md/dm-vdo/flush.c:114 allocate_flush()
        error: uninitialized symbol 'flush'.

drivers/md/dm-vdo/flush.c
    101 static void *allocate_flush(gfp_t gfp_mask, void *pool_data)
    102 {
    103         struct vdo_flush *flush;
    104 
    105         if ((gfp_mask & GFP_NOWAIT) == GFP_NOWAIT) {
    106                 flush = uds_allocate_memory_nowait(sizeof(struct 
vdo_flush), __func__);
    107         } else {
    108                 int result = uds_allocate(1, struct vdo_flush, 
__func__, &flush);
    109 
    110                 if (result != VDO_SUCCESS)
    111                         uds_log_error_strerror(result, "failed to 
allocate spare flush");

In real life, uds_allocate_memory() isn't going to fail here, but
if it did then "flush" isn't initialized...

    112         }
    113 
--> 114         if (flush != NULL) {
    115                 struct flusher *flusher = pool_data;
    116 
    117                 vdo_initialize_completion(&flush->completion, 
flusher->vdo,
    118                                           VDO_FLUSH_COMPLETION);
    119         }
    120 
    121         return flush;
    122 }

regards,
dan carpenter

Reply via email to