Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp315829rdb; Mon, 22 Jan 2024 05:17:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnpUg73IYaMhzyfbSrdpqvfHy3MoRyaogqpzTsObXVBtQllIJ/OsPv6WYW0J7OMpSoFZ+o X-Received: by 2002:a17:902:7594:b0:1d6:fe15:b588 with SMTP id j20-20020a170902759400b001d6fe15b588mr3958479pll.64.1705929473584; Mon, 22 Jan 2024 05:17:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705929473; cv=pass; d=google.com; s=arc-20160816; b=I+b9nKpC4+B1PbLp8PtAAArpCH1srI/OMQSAHAriakczESNtjOMiEelry3P9Z+G0R6 xoJY3vJniCnCL6p7KIVYCUKAAGzCrOmaz97RuqwKm6pgE0mK71pWas8abvWud5vBnE5R 2474tSomgGFX4K4bhI3cNk5uQAA1M8YD+MFl6Ap+HfN0vzD/FUkbJJhpt0PBOGY6SXsf C3hQagPjDWXQBWMoPQCnkz6PWG5CxdyCfJN1lSuLNmu50mro2hhgGasGbz0DSQ4r/cjv ATWnGsi4ahlhh5FdySGJYpgHQ+Jhd4Ko/8CcllY4REp2b830SsF8Nng7A+4tarrmEa7O fLZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dTDK7i2Q4hPQnzfb2SdByLYJyeMyokMSiVdAUDeKcK0=; fh=8qCaggPtbUrdt/xwc3MzyndUXPJZjhBPaGYsFhspncg=; b=zpTDYHfJt6hXm6LrY0t1zyXsBibuKWNYgI/rj/VK8iSZ2uDW2r5A8+m6oCBQbZcxMg VFBMmMoGDGmZZFZpFtOLbV4BheB4stj+/7SUF/O/t/MxAPA2ib3IinTpZTlQfAcLC52B wjIGUluxYha7NDk3Juae6NuBxczuIrr/AeI+TaDgm34/JsxWOJPa3TobLMmSrwVn6mqe c5yLzQoiDRRJ61u1AM5AdBhu/Lck9s3n9n+ruKKq3HUm3h344zByvmGy3LLYncireWpj 7Opsx8NC3KVgChTTvYYtTcHVsQdvUltDztJ5nf5SevWOn0nP4uwrIkEYChi0kBubJajO k1Sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IkY7xIzb; 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-1228-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1228-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 n7-20020a170903110700b001d485a81276si8125016plh.262.2024.01.22.05.17.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 05:17:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1228-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=IkY7xIzb; 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-1228-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1228-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 8CF5DB2AEDA for ; Mon, 22 Jan 2024 12:41:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F10E3D572; Mon, 22 Jan 2024 12:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IkY7xIzb" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 D4C1D3D55A for ; Mon, 22 Jan 2024 12:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705927149; cv=none; b=kU+o8u7/kK1GTf5L3G3/HDhYVoTIFhQfaOKLO5CzD7besDnZlplhHAFXTKyhyq+WNgKQp42Qjd+/GwDOktZaAN4rCKFd0dGe4TzySSb0ytEynXQrefwtFJx6CMGgO5MM6obAK93daSR+8+Ipi3sCyFOvhS+otsz+Wb82O65ADLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705927149; c=relaxed/simple; bh=Qn7dd9HK9v0F1KFFIftRsyM5xQPDc6YGUH7hJwsGprs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GiP5CBeqyIeWb48QbY7zCmI/zfPpImHEVdumn12Bzc1KfAm3GXe3VO5nyymA9lJgbBWfBotIYWTmJOFQYoAyqhPEfvRgXN4WOmswtBJcv+fwpHlavyHwRN0hqVBoz+3G9CdZSJS6WzYx+4efs45OYrsyFIjSgjq6UEVvi6PuxaI= 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=IkY7xIzb; arc=none smtp.client-ip=170.10.129.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=1705927147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dTDK7i2Q4hPQnzfb2SdByLYJyeMyokMSiVdAUDeKcK0=; b=IkY7xIzbHcC5i/U4tZ9wxiCivtWB6IaTKdv4GD4MvpAnPz8Z33luO7A8ozZOg3Vvue5TXA xOvKrXzTKYajDVFFbKXMjyOtgDG8eqyDjQh+0dRzX/3BH78WLwG5GpMuc8wt8yr20dA0jV K+BKH2/bxwk507LwJZVhUeYONdq3r6k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-413-_plndR-FP8mhZbkTFUOBNw-1; Mon, 22 Jan 2024 07:39:05 -0500 X-MC-Unique: _plndR-FP8mhZbkTFUOBNw-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 DC08E1064DA3; Mon, 22 Jan 2024 12:39:04 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D2471C060B1; Mon, 22 Jan 2024 12:39:02 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dan Carpenter Subject: [PATCH 05/10] netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write() Date: Mon, 22 Jan 2024 12:38:38 +0000 Message-ID: <20240122123845.3822570-6-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 From: Dan Carpenter The netfs_grab_folio_for_write() function doesn't return NULL, it returns error pointers. Update the check accordingly. Fixes: c38f4e96e605 ("netfs: Provide func to copy data to pagecache for buffered write") Signed-off-by: Dan Carpenter Signed-off-by: David Howells Link: https://lore.kernel.org/r/29fb1310-8e2d-47ba-b68d-40354eb7b896@moroto.mountain/ --- fs/netfs/buffered_write.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index e7f9ba6fb16b..a3059b3168fd 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -221,10 +221,11 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter, if (unlikely(fault_in_iov_iter_readable(iter, part) == part)) break; - ret = -ENOMEM; folio = netfs_grab_folio_for_write(mapping, pos, part); - if (!folio) + if (IS_ERR(folio)) { + ret = PTR_ERR(folio); break; + } flen = folio_size(folio); offset = pos & (flen - 1);