From nobody Mon Apr 13 17:09:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67BF1C4332F for ; Tue, 15 Nov 2022 13:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbiKONJp (ORCPT ); Tue, 15 Nov 2022 08:09:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKONJn (ORCPT ); Tue, 15 Nov 2022 08:09:43 -0500 X-Greylist: delayed 347 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Nov 2022 05:09:41 PST Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98D32B0B; Tue, 15 Nov 2022 05:09:41 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668517431; 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; bh=uJ6lXtZtZ1sEYf/d5F93niJVu+vUIJKmF7MEG0yD42M=; b=CYUqVNxElFXbc7OLDSqcUxvFOmb5TBlIPRXRmhagE+PwL5GvO/olITDHKJ2e1ZsJP6+4I4 PhykhIqUdLcVo7XSkbZ1aPgnNOOEP055A9MdffQi9WPR4RmAudnd9yyae2JxR0vXXTY1bJ C0ZRTAPrcRbwqlU4aTLkT7gf6AnYtks= To: David Sterba Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , ldv-project@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] file: Added pointer check Date: Tue, 15 Nov 2022 16:03:51 +0300 Message-Id: <20221115130351.77351-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Return value of a function 'affs_bread' is dereferenced at file.c:970 without checking for null, but it is usually checked for this function. Signed-off-by: Denis Arefev --- fs/affs/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/affs/file.c b/fs/affs/file.c index d91b0133d95d..4566fa767f65 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -963,6 +963,8 @@ affs_truncate(struct inode *inode) =20 while (ext_key) { ext_bh =3D affs_bread(sb, ext_key); + if (!ext_bh) + break; size =3D AFFS_SB(sb)->s_hashsize; if (size > blkcnt - blk) size =3D blkcnt - blk; --=20 2.25.1