All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] dm vdo: add flush support
@ 2024-02-09  8:48 Dan Carpenter
  2024-02-11 19:59 ` Mike Snitzer
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-02-09  8:48 UTC (permalink / raw)
  To: msakai; +Cc: dm-devel

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

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

* Re: [bug report] dm vdo: add flush support
  2024-02-09  8:48 [bug report] dm vdo: add flush support Dan Carpenter
@ 2024-02-11 19:59 ` Mike Snitzer
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Snitzer @ 2024-02-11 19:59 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: msakai, dm-devel

On Fri, Feb 09 2024 at  3:48P -0500,
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> 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
> 

I've fixed this and added your Reported-by

Thanks,
Mike

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

end of thread, other threads:[~2024-02-11 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09  8:48 [bug report] dm vdo: add flush support Dan Carpenter
2024-02-11 19:59 ` Mike Snitzer

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.