From nobody Fri Dec 26 09:24:03 2025 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) (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 DDE387F for ; Mon, 8 Jan 2024 01:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0W-5YvzR_1704678337; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0W-5YvzR_1704678337) by smtp.aliyun-inc.com; Mon, 08 Jan 2024 09:45:37 +0800 From: Yang Li To: dhowells@redhat.com Cc: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH -next] fs: Fix type mismatch for pos variable Date: Mon, 8 Jan 2024 09:45:36 +0800 Message-Id: <20240108014536.43971-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The 'pos' variable within __cachefiles_prepare_write() and related functions is intended to store the return value from vfs_llseek(), which is of loff_t type. However, it was incorrectly declared as an unsigned long long, which is an unsigned type and cannot store negative error values returned by vfs_llseek(). This patch corrects the type of 'pos' variable to loff_t, ensuring that error codes are properly handled and facilitating proper type conversion from the cachefiles_inject_read_error function. Signed-off-by: Yang Li --- fs/cachefiles/io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c index bb19b8bcf2e8..3da2b2e261da 100644 --- a/fs/cachefiles/io.c +++ b/fs/cachefiles/io.c @@ -521,8 +521,9 @@ int __cachefiles_prepare_write(struct cachefiles_object= *object, bool no_space_allocated_yet) { struct cachefiles_cache *cache =3D object->volume->cache; - unsigned long long start =3D *_start, pos; + unsigned long long start =3D *_start; size_t len =3D *_len; + loff_t pos; int ret; =20 /* Round to DIO size */ --=20 2.20.1.7.g153144c