From patchwork Tue Nov 15 13:03:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 20367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2717919wru; Tue, 15 Nov 2022 05:14:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6I0+HBDxYU8UMJO47ENWJck3n+Vn1qQJYsfUwrNl0x7F9VqLOUG2RFr++kE2v/d+dyjn5K X-Received: by 2002:a63:4859:0:b0:457:4863:2e85 with SMTP id x25-20020a634859000000b0045748632e85mr15800419pgk.6.1668518089310; Tue, 15 Nov 2022 05:14:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668518089; cv=none; d=google.com; s=arc-20160816; b=LyW7DuiSqMafzvWArR5UH9L10/032HtmoTE2z5OoXtHkUURduvLHPajsNoTNUF1Flt YWaLaNZrJB3NtA7t0UNLrhkw9Euv4prMyQslyi0M5iM1I6o/y7+m0ERdZ+qUtPOgbqir ifZb+NMfLU3vV347oanQ9R7p7xug76f69UOoxGlI8Z1ux099dnoZDwt2xe5q5OfRStSg jcguwwCGo+S8DtQNxezzYNEtnqwM+8BjtrjtnSsS5X1ZzjAsA/eHe2ntZKqffiepbgiJ v67fTTz+qGYaCNR4qAhWWQUSbRV9/gXBk4ox7RjCWyEhtNSgCE96LKYn0TFsCqwmnel4 L/KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=uJ6lXtZtZ1sEYf/d5F93niJVu+vUIJKmF7MEG0yD42M=; b=M96FZZGakiPSpmW18WeDtpEfZlBvcwIkfkdxPm81kbLRDZNZVAzYRReUCYpfB4wjVj 5cCdS6XLS4job9tYMGccuF3qstLL4flR5zZTuyVk+cNGzlcB1hmG/WP7dgoODCFgFZ7R C9S9Ip1eYJ+45w1CKO6wy70LUFoU0eJWwjivEpArk1U9aBuclP6uv2Sl4onQ+O4P9/zc SR7jn1Gq/TiFhi3WeQqE7+ENCbKXcoD6EzbKuldqQ2P4AZfpx7VBnBi+7/3m0PDvTZSG Q6I7JrfBcfCZDbMbbazy2f+Hl5mYc34N6B5PnidPm8/r766X/eNf0w0YgO4Pp82LL5De IpDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=CYUqVNxE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a63da09000000b0047011722bc6si11446940pgh.531.2022.11.15.05.14.34; Tue, 15 Nov 2022 05:14:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=CYUqVNxE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbiKONJp (ORCPT + 99 others); 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749568024244545739?= X-GMAIL-MSGID: =?utf-8?q?1749568024244545739?= 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) while (ext_key) { ext_bh = affs_bread(sb, ext_key); + if (!ext_bh) + break; size = AFFS_SB(sb)->s_hashsize; if (size > blkcnt - blk) size = blkcnt - blk;