Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp92154lqp; Sat, 8 Jun 2024 07:26:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZESGoZG7/Z91AZNRgGEuN0w+/P9seRmLTNf7H2cMVpyIYcTWNqYITHl/U0uPKuokbMhAE4oMtmJ0kQXVA0y1VoF5kmHCPIngfJDoHDA== X-Google-Smtp-Source: AGHT+IFho4O4G4CH3cnY970s+GSkbZiqjqnw1j2TztZpNBH9o1p7PDKCcxj/SodJYATV7PG3PCx3 X-Received: by 2002:a05:6358:6f87:b0:19f:3cb9:e7ad with SMTP id e5c5f4694b2df-19f3cb9eb2bmr231017155d.20.1717856776695; Sat, 08 Jun 2024 07:26:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717856776; cv=pass; d=google.com; s=arc-20160816; b=w7aBR75YkR+1xVDNYJbPlr8hmHbvtzARmjFG0M+MeG6G/ctqShGD6iRHNgjdoDvMJC mZ53J5Of5idkAnYti72FohRBSGF3Jo1bYaUuIMmCLo2MkR9+iZ8sm7ATkUeh8CCZY+tx W0QGMR0zh1mw0zcLSLQbfZ23AgS0yx1DQc3dzmmySWxnL9xlhq22VqXldp+yRWGlYKU9 xrapHeDcPJ3fGaEJyomCuPypboUiE9LDEzF0FUstcOeu/vI3eo3XlMdqhddvtFCWMEyX kGJAnw6JW9DwquNKKfBs2RwbTXPwpo1F61utYZYX8oW9hzK+Bbd3XlFEBE1QGp/D5nTO LWdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=RxvsbnsFVjeGHUDxYUhJ0rbPaZCbM8X7RUV3ynLZmic=; fh=bkQCo691Sg5Qg9w5nacXV9ouYelaE03z9d89NX2jkSw=; b=WpWuYCgZRdmsYN0ngJJ2yGwlA06+TGwNy2WCb9QBmM89h5r5fwIMy4xOcrCOipDYkB ZI1WNwZdDMzxqvCJMf8myHGyt0F0djmu/AcsQ6fj99N7YKL9lcmNr1khKRJjsBm9HTES UE2T0R6Mpj2NTwTP3Uf1Bk1r3yy6N9RVMTVefm2UCkaDa464GX1EYJDgOI4cEMV641dF YqIlp0CqcHJjXGPkAN4TmgvPs1i3lq/KAmkfCkHUtEX11sUiDBdLbZhAN2ExNU4yB7nK 0ePJBQIq9vmuhfU3/feRYvWLF8wEM80/Wxu4Pq7jqvxoq67X6A5br7mb+huXXKnbZfZI lI6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gvk3ptrU; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-nfs+bounces-3619-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3619-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e6071e7b6esi1473346a12.667.2024.06.08.07.26.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 07:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3619-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gvk3ptrU; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-nfs+bounces-3619-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3619-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B8ED2816C9 for ; Sat, 8 Jun 2024 14:26:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8C13178370; Sat, 8 Jun 2024 14:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Gvk3ptrU" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47AB017BBA for ; Sat, 8 Jun 2024 14:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717856773; cv=none; b=R+uKWY5Nq5Y8ndX67MEtdxA2kbw47RIGiAimoM6ErsIIwgQTu+ZcnqkLaYj3WKmn0t3s58trWWGaNjZBeQ+170Y70sAxcgz+z5BEzzAdGeGvrwVDlOwTwl5w4L8Qr95WYEvZl2qVFSLO32PK/FQuV767S55KfyHB4ZCFmyPRCc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717856773; c=relaxed/simple; bh=6pjvm0bj2eyfLgd7Edv8xaFdr8mHKwGZeHRmbZIH04E=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=JPd8QslXwodDNbYvZa51xrGMvurg/VdKKrdJHnlY5fuKTtC7bRRKwvVWmEcRjzO3lb+Vs1sz+Jgb5RZuWMbKh7Pt13brYRD7IAC61qqnkilME6So4WUVrrx1XyqR0ItU8UvbwXPqFmUBsIlO6NCLsuprJU0PkcNMnVAvkp48Z6M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Gvk3ptrU; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-52c819f6146so426051e87.1 for ; Sat, 08 Jun 2024 07:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717856770; x=1718461570; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=RxvsbnsFVjeGHUDxYUhJ0rbPaZCbM8X7RUV3ynLZmic=; b=Gvk3ptrUpgV501keB5xF4RjrpN3+2BRYBdw8iVkgX1QeIwir7oUWKGod9WHJDJsT5N rBCeaPwYcoridzKT71rgHjNZBYr1ignRaC1LEPPnshAnkoEB3kPzsAwQevzRqVLwSMAC xlCnnAl8hnlaoMQU5lRDSQah8V/yq9i0rd0Tk01IekbSwTu1Vc8G2R8N5fcrBBB/4UB0 qLO9wc5Pt0YpO2FI1mAym8XcGZQj6Z0tsVAfJNxvN2ItPS8Gft/xyc0xrPSrhnUSJqkm NoL9RWYLae7WWLEbD3pS2QkkiX8BUfHQz2TrYV1bJYLaXEXuPk4l6491oHCuLF6KCcOw OC1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717856770; x=1718461570; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RxvsbnsFVjeGHUDxYUhJ0rbPaZCbM8X7RUV3ynLZmic=; b=rPgTh4Am4pldJUuhleTsnLewjj7GX1DDpyp+aDKu/m9Pc3wVR+V9tChIZMNqnlNOu3 QNr8hbmQqPvHWncdFZ2/MJEdLHBOzZ9CXjZsIA9VD7xOkV2PbDXY+2qDNVJgs7aTC+8T 3nsow8sOXXbwRgZ0wr+yhQHsUB0108AdjmNKLexB/no8aCQnR3CHOl6BnL2CgUg1Yvvy rXtIm0PaDaTRYXnXzCoCiLOQWEPz7ejtUeKT0W6A6hletFbFQ5NYO7r/30NzE/4rN+rV E4RE3Wam1nKIgtOUxz3LXsOu0Sda+pJLjHHK4byu3Mc0gvz8kcrriqJntTNXtQ3SkQTW rG+g== X-Gm-Message-State: AOJu0Yz5jNuDd2oAjSBYDTp8Y0HJvEmFR3bhwvBD1dmp1IvvauEp9eO8 VLCFmOMZ9PP7tzBFKglpYS+QDkjumklKGkWKsf4IW8k6j5pw+CJiSedpKMHg210= X-Received: by 2002:a05:6512:3d27:b0:52c:8417:cef7 with SMTP id 2adb3069b0e04-52c8417d079mr261604e87.42.1717856770219; Sat, 08 Jun 2024 07:26:10 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5d4a827sm6501847f8f.36.2024.06.08.07.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 07:26:09 -0700 (PDT) Date: Sat, 8 Jun 2024 17:26:06 +0300 From: Dan Carpenter To: Trond Myklebust Cc: linux-nfs@vger.kernel.org Subject: [bug report] NFS: Use of mapping_set_error() results in spurious errors Message-ID: Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello Trond Myklebust, Commit 6c984083ec24 ("NFS: Use of mapping_set_error() results in spurious errors") from Feb 15, 2022 (linux-next), leads to the following Smatch static checker warning: fs/nfs/write.c:318 nfs_mapping_set_error() error: we previously assumed 'mapping->host' could be null (see line 315) fs/nfs/write.c 310 static void nfs_mapping_set_error(struct folio *folio, int error) 311 { 312 struct address_space *mapping = folio_file_mapping(folio); 313 314 filemap_set_wb_err(mapping, error); 315 if (mapping->host) ^^^^^^^^^^^^^ The patch adds a check 316 errseq_set(&mapping->host->i_sb->s_wb_err, 317 error == -ENOSPC ? -ENOSPC : -EIO); --> 318 nfs_set_pageerror(mapping); ^^^^^^^ But the next line dereferences mapping->host without checking. 319 } regards, dan carpenter