lkml.org 
[lkml]   [2023]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fix build error in function vfio_combine_iova_ranges
On Mon, 11 Sep 2023 17:41:02 +0800
Cong Liu <liucong2@kylinos.cn> wrote:

> when compiling with smatch check, the following errors were encountered:
>
> drivers/vfio/vfio_main.c:957 vfio_combine_iova_ranges() error: uninitialized symbol 'last'.
> drivers/vfio/vfio_main.c:978 vfio_combine_iova_ranges() error: potentially dereferencing uninitialized 'comb_end'.
> drivers/vfio/vfio_main.c:978 vfio_combine_iova_ranges() error: potentially dereferencing uninitialized 'comb_start'.
>
> this patch fix these error.
>
> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
> ---
> drivers/vfio/vfio_main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> index 40732e8ed4c6..0a9620409696 100644
> --- a/drivers/vfio/vfio_main.c
> +++ b/drivers/vfio/vfio_main.c
> @@ -938,12 +938,13 @@ static int vfio_ioctl_device_feature_migration(struct vfio_device *device,
> void vfio_combine_iova_ranges(struct rb_root_cached *root, u32 cur_nodes,
> u32 req_nodes)
> {
> - struct interval_tree_node *prev, *curr, *comb_start, *comb_end;
> + struct interval_tree_node *prev, *curr;
> + struct interval_tree_node *comb_start, *comb_end;

This looks cosmetic, what did it fix? It's not clear to me how any of
this addresses the last two errors. Thanks,

Alex

> unsigned long min_gap, curr_gap;
>
> /* Special shortcut when a single range is required */
> if (req_nodes == 1) {
> - unsigned long last;
> + unsigned long last = 0;
>
> comb_start = interval_tree_iter_first(root, 0, ULONG_MAX);
> curr = comb_start;

\
 
 \ /
  Last update: 2023-09-12 00:06    [W:0.046 / U:1.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site