From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF3A3ECAAA1 for ; Tue, 6 Sep 2022 13:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234206AbiIFNax (ORCPT ); Tue, 6 Sep 2022 09:30:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233940AbiIFNav (ORCPT ); Tue, 6 Sep 2022 09:30:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7771A2AE03 for ; Tue, 6 Sep 2022 06:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662471049; 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=bCl6uulMyxrVlr2gxACbm/zfYRoeE0Wcxnn2cAdr1a0=; b=Ff+mlRqIJk6gNMi9Hicw8WZODv4/hZFwb5CHa75DS6GMwPlRqErB8sECZYbIZ0y5+V5+Ne GAdE/ee5nwZk+lKesZdyhcV1ZT4hv+5MpjoPyFrhjwvS7LJxIuo4pT80MFYeMWAv5O7Fie vW4frXd4uvv6iIy7BZ5f5QvQMlfyGlI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-25-jATdod-ZPH2s4yFEqEid-Q-1; Tue, 06 Sep 2022 09:30:46 -0400 X-MC-Unique: jATdod-ZPH2s4yFEqEid-Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C750F8039B2; Tue, 6 Sep 2022 13:30:45 +0000 (UTC) Received: from localhost (unknown [10.39.193.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 457AE40D296E; Tue, 6 Sep 2022 13:30:45 +0000 (UTC) Date: Tue, 6 Sep 2022 09:30:43 -0400 From: Stefan Hajnoczi To: Deming Wang Cc: vgoyal@redhat.com, miklos@szeredi.hu, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] virtiofs: Drop unnecessary initialization in send_forget_request and virtio_fs_get_tree Message-ID: References: <20220906053848.2503-1-wangdeming@inspur.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="S+kjWGQJm00xfWBG" Content-Disposition: inline In-Reply-To: <20220906053848.2503-1-wangdeming@inspur.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --S+kjWGQJm00xfWBG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 06, 2022 at 01:38:48AM -0400, Deming Wang wrote: > The variable is initialized but it is only used after its assignment. >=20 > Signed-off-by: Deming Wang > --- > fs/fuse/virtio_fs.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c > index 4d8d4f16c..bffe74d44 100644 > --- a/fs/fuse/virtio_fs.c > +++ b/fs/fuse/virtio_fs.c > @@ -414,7 +414,7 @@ static int send_forget_request(struct virtio_fs_vq *f= svq, > { > struct scatterlist sg; > struct virtqueue *vq; > - int ret =3D 0; > + int ret; > bool notify; > struct virtio_fs_forget_req *req =3D &forget->req; > =20 That causes an uninitialized access in the source tree I'm looking at (c5e4d5e99162ba8025d58a3af7ad103f155d2df7): static int send_forget_request(struct virtio_fs_vq *fsvq, struct virtio_fs_forget *forget, bool in_flight) { struct scatterlist sg; struct virtqueue *vq; int ret =3D 0; ^^^^^^^ bool notify; struct virtio_fs_forget_req *req =3D &forget->req; =20 spin_lock(&fsvq->lock); if (!fsvq->connected) { if (in_flight) dec_in_flight_req(fsvq); kfree(forget); goto out; ... out: spin_unlock(&fsvq->lock); return ret; ^^^ } What is the purpose of this patch? Is there a compiler warning (if so, which compiler and version)? Do you have a static analysis tool that reported this (if yes, then maybe it's broken)? Stefan --S+kjWGQJm00xfWBG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmMXS4MACgkQnKSrs4Gr c8hAnwgAr+QWzw860ulBE175xxGhGz+svhuLqPnyhkkQWyLQ+SsHglf6wgX8wyJo 3GImaRGa4ntB59O6CORrt1m7YIFLeCAob1b4AooxalOuXeP3st5ryPhMO81RovYL L3hVXfFQQeDboa2r7KdH8EyT7sJSrzsOpLQpFfDXOrpDfQrdzZPwSRcU4DHr98QW 0ErLih20bpg/tptA1VY8+qfrXJMUYfFZkfcFgWo6F8GLFJGieGKKxEbAzOczz9IS 7mFLUtaRglCb9dDLItuOZwr40Uipgj1jqKx2JweQx2UYdt8hqZ6yRLbbOvxQH3R5 i+axLSVNdiXXrXNKkTGNKETbFwpEfw== =3X2b -----END PGP SIGNATURE----- --S+kjWGQJm00xfWBG--