Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1265985pxb; Sun, 17 Jan 2021 02:47:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxf2uD7fWAIcxjYB1rFW5yJlillfWoto209YHJIevYu7u1zvKmnNEq6ejD1PSAsgJAl64X9 X-Received: by 2002:a17:906:4a14:: with SMTP id w20mr14876989eju.192.1610880473129; Sun, 17 Jan 2021 02:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610880473; cv=none; d=google.com; s=arc-20160816; b=Vm0jiUwxdNP7h2NrycUL1qDvLuzF4t6qVlLGnWeyAlHtEUg+YBG3NhsMpp6twIypUh q7mQg4c+erQ+I1PEMr9QnOwllTPy1MCho1VN8iM0FnTNln03TBIyyCf5KUJecqeEbZJQ zGY3OFeZ1sAl3ckOnINr2EjlAnU7SW1MQdgORk3nm7dE3ii3px4VvNoKUsNxM4zAXeEZ pIeznYhQ8yfbVyx9qCelVtv0n729P3es7mHBzT62J4HW/4D0neDjzEIoBw6cWh5wVyc4 yPy4jm0wVc9jZYz4YW8Y5665uSGT2KmiXJWh/mVkVQHFdeRyMTRcL/G4exr14d+Z1L2Q fGVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tml6sHp1NjNR0HFEv3Pcp5mMcpBNidTf8muhn4StX7M=; b=neAlPc42VV2zd2VKW6AaujF3aglOFZRYW1+vfwxbHsbHC8FgbcphZ9PdyBLkWEjVi4 JZGcAMbM4YGblmnldFG4lygbnMh2qIxoTff0RCmGWoBDB4DCF3CcIWH2Q3lu94chyGDa d6eQ1tnTCZpinW7358AR8gxB+JeJs1wtHHHDHWXeM5KNEp3rOiMnPjhaTwCWSZAERgAx wnIJ9mxR1Xbj79KX4GEtKZbTbwylDG1nVz+l8gmdgn1RnFgq3aL8tD6t6FpJS9z2BySq SdQAtyraqve1V7DszfUhNb0zw/4lt3TmRrUg1hh3AQZeVmKjmo5+CxJaS8bjeZLjjYqS Ty3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EAay2NVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si1004979ejx.42.2021.01.17.02.47.14; Sun, 17 Jan 2021 02:47:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EAay2NVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727480AbhAQKfl (ORCPT + 99 others); Sun, 17 Jan 2021 05:35:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57528 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbhAQKez (ORCPT ); Sun, 17 Jan 2021 05:34:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610879581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tml6sHp1NjNR0HFEv3Pcp5mMcpBNidTf8muhn4StX7M=; b=EAay2NViUUTMDIOomnts8r3gJI2rzrARwqjlNh2Ab2F+l/9F74wnP11umiCBI7ZHYXBr2b U4PqfAcwg0mPKHnBSqPGeOsVwwT5wY3gnsU/DzbpOWnb+Oda8ll9FOD7HvkiJdKJOqbJSJ vzyYZEm9uNa4aHOnWi67DK9/pyFOjT4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-V_9zE4-0MfO6X1XqUu2_Hg-1; Sun, 17 Jan 2021 05:30:07 -0500 X-MC-Unique: V_9zE4-0MfO6X1XqUu2_Hg-1 Received: by mail-wr1-f69.google.com with SMTP id q2so6709955wrp.4 for ; Sun, 17 Jan 2021 02:30:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tml6sHp1NjNR0HFEv3Pcp5mMcpBNidTf8muhn4StX7M=; b=fVV0aWtqptGXK8xVWXK05OF/zatpetRsS0onXPW+LTGqjc0aRgZviJIDktCgPlRytv NsVTDTRUniHJSFyA31lR5TPX3tC1C41w39b6tXmgxDp982+9l6ED/5pciElBRuZCquDF KE/ti6hWPmqC4I4jgQrVjhEhQ4iZBC69yw+BU0uAkVDAylcFeVoebNNFj+ZpDEyfQOcR Ou9evJTgoBlvIbpEU3Nx3oeo7KJCQzCEpoUvKwLYOux+bz6GFYjtvBCZxQi+WWp7qihb 52XKXOarmJKegF82nBUsWNs43JIT5GGl2mpvB/8it/hRhegSuqomuwmwyYmJ13WJJs+G nAhw== X-Gm-Message-State: AOAM531lhtZzhuEI1E/shACzS7X86H2NKA1vxOck6qMEgXTRCRgHp7Y9 H5NA3gbTSHTLRkEefNwtSW5lvuegjiblFycfMZOcTL3wAbx8DIzNwIu8rYXYHGrQ0c1ak7fMsdV u/MOsRioEd1TekVootN7wCv+u X-Received: by 2002:a5d:4ece:: with SMTP id s14mr20882390wrv.427.1610879405575; Sun, 17 Jan 2021 02:30:05 -0800 (PST) X-Received: by 2002:a5d:4ece:: with SMTP id s14mr20882379wrv.427.1610879405440; Sun, 17 Jan 2021 02:30:05 -0800 (PST) Received: from redhat.com (bzq-79-176-30-58.red.bezeqint.net. [79.176.30.58]) by smtp.gmail.com with ESMTPSA id c20sm18850213wmb.38.2021.01.17.02.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 02:30:04 -0800 (PST) Date: Sun, 17 Jan 2021 05:30:01 -0500 From: "Michael S. Tsirkin" To: Jason Wang Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, elic@nvidia.com Subject: Re: [PATCH V2] mlx5: vdpa: fix possible uninitialized var Message-ID: <20210117052810-mutt-send-email-mst@kernel.org> References: <20210114070904.9981-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210114070904.9981-1-jasowang@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 14, 2021 at 03:09:04PM +0800, Jason Wang wrote: > When compiling with -Werror=maybe-uninitialized, gcc may complains the > possible uninitialized umem. Since the callers won't pass value other > than 1 to 3, making 3 as default to fix the compiler warning. > > Signed-off-by: Jason Wang Of course if it's actually something else this is not DTRT ... As long as we worry about this warning, let's have defence in depth: case 3: umem = &mvq->umem3; break; + default: + umem = NULL; + BUG(); + break; > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index f1d54814db97..07ccc61cd6f6 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -703,7 +703,7 @@ static void umem_destroy(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue > case 2: > umem = &mvq->umem2; > break; > - case 3: > + default: > umem = &mvq->umem3; > break; > } > -- > 2.25.1