Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp572725lqb; Wed, 17 Apr 2024 05:16:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/Th+sEdqtp1qei3pMqF7Gl7eAPOICF/2e2FVktP9RRPCiLGPN5BX0SycTQ16lGZvAPJkpBCYTfHKDPDdV4HW5PwUuajZUvgqiq4Cu4Q== X-Google-Smtp-Source: AGHT+IGOTJ9mckDVWngpkBSWVvyybtQ56adqdk+q9OHiMe8Pf15UZPjz6hHPc+UitmEcBehpc7dd X-Received: by 2002:a05:6a20:9499:b0:1a7:5fbf:3774 with SMTP id hs25-20020a056a20949900b001a75fbf3774mr18421502pzb.55.1713356214547; Wed, 17 Apr 2024 05:16:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713356214; cv=pass; d=google.com; s=arc-20160816; b=MLhHlgjAKWAd7dQEstt0mDyqO33We1IKUNBppY2CBrOOONep7f5LrJAJN3+PzyuxKa SbIWxyCqPqhziYWVxBFyjfo/CRnVhXq55k1FhiWDIqMcGP6kZnuK5ILtuKO0y87jNFKF J7Nn2T2hCtec0AuG+J+Y4koWUH8lq4GD9FrHZ1LRZLY/io2iu1YzbYu3Pdl466ykBpmr 0TkvgjPJga2W/i2K+rLpVUPfOtLbkhguSfdQqqsq/FXSz6mrNuq0jiNtnzjOdpe6RWDN 44EXLv5yie1WHhyii74EbL56Zc2TcLcm8E+i0Ts6CdG6cRDUberCf/0O2/HfNtw5d89U 1jdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SpGL5oiHNymfpDBqRk6qFuboZq9jV5jtp3Gg9K4gvNo=; fh=xHQKRgVElhvYA6C5Fg3MQR8eORbb5OiK+0O8CQj7+Go=; b=gHwLmnkepulEE1iUaMIJknsEUDkP29EOaCNZdszWZIOHbPeY7u/UmzYhPUDm6S9Jsw jm9YksFmFC9tK1Fn6Joev/SaB3iSMAeJeKOJZMAAg0FbPbZWz7fzsH7FZClvyXXMPyrg ie4FXMli7ISu8uoHpWQR5bv2zAHWm25ZcHnFMLmrtXeyI/3F8Eq36fCXzXfTnr4kJ7fo GcswH5J7DHJVUfqch0l+MVLpQyaiwJGNZTMLPFNi8/g25Fy9SgKPRw8PSRA9bJOKXHh1 UXksTYyr6jaDr87qwUpYV3UWZ3w/VnGPGKjUjjCP1QelodfYG12RsizRbysoTyIYFLaK 8ffw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SMDh8XPM; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-nfs+bounces-2873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lr31-20020a056a00739f00b006ecf8c67605si11177723pfb.72.2024.04.17.05.16.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 05:16:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SMDh8XPM; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-nfs+bounces-2873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 85518B281CC for ; Wed, 17 Apr 2024 12:00:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C8DB13CA9E; Wed, 17 Apr 2024 12:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SMDh8XPM" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 6904A13CF94 for ; Wed, 17 Apr 2024 12:00:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713355213; cv=none; b=fHXn8ylD3lPdV761QKYUdDm36QFbC6dbs/V1dRa93JN6jTu5R+e7aydEEPWi7ruLMb4/wjiRKdO07Qf52RMdnWbXqMxzjAdsLp+XWi/qy2omtqt2Rccbi0ODyCrr02ef/2MkiM9gBiEmmfs/YVWJCD9jMmnDODLiqJLl8LkFte4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713355213; c=relaxed/simple; bh=aRxMVm4dnPLJtjJcJ2b8vTZhKprQmDPGJPUnDo3YCus=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=goviSmexeQgX7Pyl0/agT1zMRy6g3KbrYKWJYmn8vgnDbM8UoDy1R2vAQFh6vU693ADW1Oy5vVj1eO3jeIF4LfccNsnHNzDC2+MEm9wwHpf2lrWpHK+IV1FUmp/gRx/GmupFf0QIl0tyAalwalqx6Thh7rK/j7XRSoPFHz1Vc2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SMDh8XPM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713355210; 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=SpGL5oiHNymfpDBqRk6qFuboZq9jV5jtp3Gg9K4gvNo=; b=SMDh8XPMD96VejwkJ6B6/kJJYNdjC7vow4uhyr4Zvflf+/lhfNNPiz+/cYObJiS9f+T2/e zQX6npz/NaudOmJQryIwEiF2fHRVacWa85tFx4LIjnt6Ii/gOQ17UQPlmDeb7SsqDabB9U Q+ilmxMYxbEEbxgAowpu8HJklkcVlsk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-452-HK0yOyxVNj-XxJ9DXQGKCw-1; Wed, 17 Apr 2024 08:00:06 -0400 X-MC-Unique: HK0yOyxVNj-XxJ9DXQGKCw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5017F3810D43; Wed, 17 Apr 2024 12:00:06 +0000 (UTC) Received: from [192.168.37.1] (ovpn-0-6.rdu2.redhat.com [10.22.0.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C4FA1C06667; Wed, 17 Apr 2024 12:00:05 +0000 (UTC) From: Benjamin Coddington To: Dan Carpenter Cc: linux-nfs@vger.kernel.org, Chuck Lever III Subject: Re: [bug report] NFSv4: Fix free of uninitialized nfs4_label on referral lookup. Date: Wed, 17 Apr 2024 08:00:04 -0400 Message-ID: <13EE0F08-5567-48B8-A7C2-88A086FBDA89@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 On 15 Apr 2024, at 4:08, Dan Carpenter wrote: > [ Why is Smatch only complaining now, 2 years later??? It is a mystery. > -dan ] > > Hello Benjamin Coddington, Hi Dan! > Commit c3ed222745d9 ("NFSv4: Fix free of uninitialized nfs4_label on > referral lookup.") from May 14, 2022 (linux-next), leads to the > following Smatch static checker warning: > > fs/nfs/nfs4state.c:2138 nfs4_try_migration() > warn: missing error code here? 'nfs_alloc_fattr()' failed. 'result' = '0' > > fs/nfs/nfs4state.c > 2115 static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred) > 2116 { > 2117 struct nfs_client *clp = server->nfs_client; > 2118 struct nfs4_fs_locations *locations = NULL; > 2119 struct inode *inode; > 2120 struct page *page; > 2121 int status, result; > 2122 > 2123 dprintk("--> %s: FSID %llx:%llx on \"%s\"\n", __func__, > 2124 (unsigned long long)server->fsid.major, > 2125 (unsigned long long)server->fsid.minor, > 2126 clp->cl_hostname); > 2127 > 2128 result = 0; > ^^^^^^^^^^^ > > 2129 page = alloc_page(GFP_KERNEL); > 2130 locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL); > 2131 if (page == NULL || locations == NULL) { > 2132 dprintk("<-- %s: no memory\n", __func__); > 2133 goto out; > ^^^^^^^^ > Success. > > 2134 } > 2135 locations->fattr = nfs_alloc_fattr(); > 2136 if (locations->fattr == NULL) { > 2137 dprintk("<-- %s: no memory\n", __func__); > --> 2138 goto out; > ^^^^^^^^^ > Here too. My patch was following the precedent set by c9fdeb280b8cc. I believe the idea is that the function can fail without an error and the client will retry the next time the server says -NFS4ERR_MOVED. Is there a way to appease smatch here? I don't have a lot of smatch smarts. Ben