Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4431202rdb; Fri, 29 Dec 2023 01:10:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0XLrlXGj85qGYCid+zPkRniFW0T3T9n8ZOchB2Fr8+5y8DLok16Q1lxs8wWvVRkn4dUNj X-Received: by 2002:a50:cd87:0:b0:54c:657d:42e7 with SMTP id p7-20020a50cd87000000b0054c657d42e7mr5092069edi.75.1703841049045; Fri, 29 Dec 2023 01:10:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703841049; cv=none; d=google.com; s=arc-20160816; b=oMogFVQM8pzTRvmwODTNOQtq6q0Io6x1neY3sO+iruGysP1ZIRxvafWecB6E7sjRNV 4rO/xX947gxugVQbcNUgW5NsBtLjUJp0J+O9yQbJ40rkqGzrD3d/G4BH1M1booLHJJ7C ShODDjpNVe1Na1hPaX0l5CdhEXB8zX9D+NZQ1Hj07AE94PRf8RDYJkxQjaurG03AuqjK XpzXMyHvtW6VltW0iwiYoWnbl21tLOWxIQTmmIaFUt1GXbm7VAIMxAWtDk7hue1914qL 4itnlZ+D6sLzrScb/XNUiQgKet/qlANgCTQuhcAkIw83piXBxWgubPPA9qNsQuJlr2Nl lSQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=Ne9pFId3wJ0smUQbmU/cER0BPDlA/4bJ9kpUVnQDLE4=; fh=btmUblJLu4Tc8QqqoxOhrcPACe26S9GxXVkwFB1bUFw=; b=uUgCj0BiDbpRIFrYlJARgOJzVYZyZMyhWjYWn5FDpXx1b97DwiTBiV583A0bZHP8L5 +ErFauAud/UCHUNcBUtX1ldjEgE+TsC4Qu9rISxFP58fPzaslcuSufrwgEEyabEV2+JV PXhJBIQWhVdbSqtEGHjrbUixyIDIlJVLgYDjpSxPO932v9MvvbM4Djc5mEEqTTlvCODn lo6r5vsceAy6Fzvs4vTLnt0LkBdqxe7YfP5SrgMmt1lJO2ArZohGQnzBTeoh2kebSS5B 5qP7ZcUPtJeddK9MHAAgm3JMUcRFcudt7cHIXG2TLKYZdfLxOoxhTcXWmcSjIS47jVxw MNnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b="w/0Mlf1E"; spf=pass (google.com: domain of linux-kernel+bounces-13019-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13019-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b6-20020a056402278600b00553830ec916si8169361ede.194.2023.12.29.01.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 01:10:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13019-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b="w/0Mlf1E"; spf=pass (google.com: domain of linux-kernel+bounces-13019-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13019-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C9DC71F23961 for ; Fri, 29 Dec 2023 09:10:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC2AA10A31; Fri, 29 Dec 2023 09:10:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="w/0Mlf1E" X-Original-To: linux-kernel@vger.kernel.org Received: from mout.web.de (mout.web.de [217.72.192.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE8D110A00; Fri, 29 Dec 2023 09:10:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703841009; x=1704445809; i=markus.elfring@web.de; bh=kwp02RABdJCyZ3yl2RoylrMKne6oKDRA7rQaRstQKcg=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=w/0Mlf1EnYN0Ur/89VJwh68FifaYEyxE28/oywR0ACikQKiPGrV1BWoEH/X9HPS1 LaspxeVbe1bPLRS4DMYi7uMRuzUc4A+GqZpnzAxTYS+9+Q6G6+NlSw4XYqsP5Y6OU kOwpyVxZCd3zjrzUd4yyu0gf2kHUc59AJXDIuZx5mAWe1gk8rEREY3b07MTn8xa5b i33jOxc/FZIQ4ThGMf48a3xmaJz6/1e4YGpsitX0jQFfBQi/poRpA4/dK1N7ZNO05 CfM95utptyKXMkDDMpgzdd5gJFQs1yDcwligZTE+US9XRkTsW/fZjc7LWC/oCCdbW lkWukxTIcwOMi+f2wA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N30ZL-1r7GrE367x-012vCR; Fri, 29 Dec 2023 10:10:09 +0100 Message-ID: <54b353b6-949d-45a1-896d-bb5acb2ed4ed@web.de> Date: Fri, 29 Dec 2023 10:10:08 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] virtiofs: Improve error handling in virtio_fs_get_tree() Content-Language: en-GB To: Matthew Wilcox , virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, Miklos Szeredi , Stefan Hajnoczi , Vivek Goyal , LKML References: <5745d81c-3c06-4871-9785-12a469870934@web.de> From: Markus Elfring In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:t8qsjc2WYogtClPaVEvIXtsNeBDm8MJDsW4YwyyK3rWmuIV3a4J QlQx/LBSww/zT37OmCIC+b+h8eAVMaxvyCeDWDe1qh/JuvcJmdUXVXLRZSsXYgTylyS0tex WUUn/LBa8ZwmfWwBQXUfadtxSklkmuz6ADt8brttOFiBPPT2QfwBts0LCPPzTpdXhgGQVrb Yc+eibgoW9zVV2le4L4VA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:1dWv8dhDypk=;y5MKr3i2uBTJEttlXgbnMgeGRrY 3Or+GGM6OkF/cGX0FbckdLwIJqkA+sPtuSFEv90y5II1CEPFHlsykumPWYthXiPvi6fCidWmx zuk2lLqIRUmm5nDYPh36lRkmwz1D50xQvzkyx/gHMNFnKjS/DUkHNXw1TG67PBSsc6xFK8r2z AHuswbhFhwdVWfk1Abq1GenYxugBb0HBguYpBNNWEiutYf6HNhieK2efueVqonuJBnBHTr3KO 9R7+A28uv8IWBLECEmQb/fPN2D3Kwycwx4+lm6PBPl5EtqbSTwawM26T5wYKiE4ABMPk6hykT PDvv/Q83HLYoXQeZ5r3dBNo8Rgbya37z3nmO9X9+RGDWAltocxMnLG87pKI7LtYJdy0QHxNxm yrdxUDK9CNQHyorZzCzOz42857LRbJz2mcX//ffO5TIKkOkraXRUNi2N5oHLKMKhudMXjEWQo YVytx2w63SUXoC6YXlWxI6SkgCO2pOkFkag5Z9BKR0zpmH3iTidyF7ZLHlWldxrTH6O1AM8vX /jQGx6CN6X1OcTrJA5Y/za03MfacYrSy8cn2QX0FwgkzTfhAlnkdRErrdCD4wfq4XLItE0hwX PKF4XVyLcVgzBb2RcJSdr7VCU2WrIef3Xej36/CALQGGlPqCOgthpPIqh4ZMOCS4zOp8MvM0w ysPJkzHyTdfWk/q0ngJlZeVGpc6Rmh4R7ofkpCwFuQO14nrQIraKC5Wm5FnaneltZTMh9rPHD mlGnQYcnQwtZz4UF/mYUQL5ywnU37jbSK1CtPPigiUtYGTAckNQ3znAVeQQHR3fTxyb2M9m5r nUWLPOlRgtyIt67JIGSDvj6GT6J4ShsRy6aptNNbhyaDTjPAjGSb10tvsqsqMIp8q2nTKPOq/ goN+6E3Kd09NSHMF5IydgjJUhv5zGC9JiL/Vt4Te2HJZE+fFMjfLUsxWOiGrKamgNvSVgoUQc /rUGAQ== >> The kfree() function was called in two cases by >> the virtio_fs_get_tree() function during error handling >> even if the passed variable contained a null pointer. > > So what? kfree(NULL) is perfectly acceptable. I suggest to reconsider the usefulness of such a special function call. > Are you trying to optimise an error path? I would appreciate if further improvements can be achieved. https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+go= to+chain+when+leaving+a+function+on+error+when+using+and+releasing+resourc= es Regards, Markus