Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3453261pxj; Mon, 7 Jun 2021 10:59:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUz3MBSjHyTIL1UdxN6QSsCn8CMr7vH2eDhU/eL07AkzmkSgKRYrwFX6ejNCzMDMwXYA70 X-Received: by 2002:a17:907:2044:: with SMTP id pg4mr19003000ejb.447.1623088750681; Mon, 07 Jun 2021 10:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623088750; cv=none; d=google.com; s=arc-20160816; b=f8hMIlPxKpYyh/G9we0dcamFK/yTBGh5ZQNFJzMCT9U9Tc4EQsR9zw1nqtyPF04A1M VmCK5iI3DxWsauvD+NZxcEQW87DgkwSJjAdzJ7zGytmNNVIfxTRjTFUJQbcP+AJ8QM3f rCsqROAQdNjD8OAjF/6OLP3DWyf7w+HvLugGuQfT0xlJu3YGsGyncX4CMl0KNRb68JDw ca1IfAWAUn2EKe79u21nNSV/wVdOKKfwlqYYybwkOBeCT53T3XeHb5doLXKJC/fKJOjn 2LbnU/z9E5f/atYjckX+uQ9t/PDEvdOpjhwxmOk7Uo+OF5fBb0Ej2KMxwjjsRSBrLvyX k1Uw== 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:from:dkim-signature; bh=GsTudBiopkT0S161YelwgAWGn2Y8C79FsjSzlUseO1g=; b=07ak+V+RkSfhG1cNEj+JWJyI45qpj+F9hv5KCBhX63DWn1LNcorYZBq/vuPhIfEjAB HlkMQWhXGEYOWvHPW1tgSQvpqoud6Ql6r/zdPZWrAo+X/n2Sg6YRCT7Xar5n7zRjMeqR gz8LboTNp9igsWKj9As7Dz5o7mAl98cleNsx36sDNC9AkuD48G6+0OBBxIvZXU/w9tXV A51CVVqMTud8i3iBRpsIou+ZhoSEcooVrq0Bz+7w7yqAzFR+qc7lYX6DwFo9MeE77zbw e/I2pPrCVi0wL7aA+n7LXKtl/akJHBMES7iBYWO3ULKNxAxUpL4HM1UHIKAbf1q8NYBa zgjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jI6eu1ah; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si8047903ejf.18.2021.06.07.10.58.42; Mon, 07 Jun 2021 10:59:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jI6eu1ah; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbhFGR6G (ORCPT + 99 others); Mon, 7 Jun 2021 13:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbhFGR6E (ORCPT ); Mon, 7 Jun 2021 13:58:04 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C6E4C061766 for ; Mon, 7 Jun 2021 10:56:01 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id z15so9394178vsn.13 for ; Mon, 07 Jun 2021 10:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GsTudBiopkT0S161YelwgAWGn2Y8C79FsjSzlUseO1g=; b=jI6eu1ahiNJ8Mvuowl11WLp1ZLVaIFd9xyRMoTt6UU/+qRxRsJbY9DVUGzZU1CDuJE wrlYpd07oAwDDsCqOLYcECvrLSEpWdUIRrLCjV9Du9TWxncMB5Dec1zB9sI2jMVeRlXP VgT8r6F4dO1ObbjDMCmmRfWBHLE+7+6nhBwfN1qgp6qqJetRgpnx9SEDr9NxbQi+abYU llzO9RevmuONUeN2AoCnwjzBHuBfNp6XqYmt1Q1aBg16Fv9qF5RgAJPRrVhcoT1ptK78 58n3gkqwpYcxomAFv2797K5OT4J3MaNcHLKZSFXezs2iJ/aO6xLpFpucKrWsZc+yQ/nM OuNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GsTudBiopkT0S161YelwgAWGn2Y8C79FsjSzlUseO1g=; b=VCv/UwI2qe5ELaZnaMc1IsVuUpu0atBEmoUDxW/ZYcTTBQ8R1UT2SxI0Me4Gdmjm8T JZA6HBWPgI6bn6djunyy52k2AJ0R8gir0GpDfWAnlS3/DAc9Hf5oI5zG6DlSROEPHCB2 FooMM31WqrLYznGSJzwQS0kSqwGaEvSS2meq2C9ewvlahJkTV3B0e1n9vK2HaBLOu8oJ JzpP5N+jW0AMAkokiedwq2e1d8bHJdvLTPozxiswEfK8MkIgMmu9K+1Uc8SadzX/4uRy j567QEoVydwxtaHxvsBUTrndnK3LFprTM8xU5mSCvwP0uAr6nx+63mArIkYORLF8bvZy xOmw== X-Gm-Message-State: AOAM530Z3o4Vx+DxjVHFa/s8uFVR5Mv83I8vbMqzIJECAeRvA4R3Cg3u 2r60IQb4A20iV/3lTzccXj1yvW0oEyZWdw== X-Received: by 2002:a05:6102:dca:: with SMTP id e10mr5247559vst.47.1623088560394; Mon, 07 Jun 2021 10:56:00 -0700 (PDT) Received: from leah-cloudtop2.c.googlers.com.com (241.36.196.104.bc.googleusercontent.com. [104.196.36.241]) by smtp.googlemail.com with ESMTPSA id u6sm2489071vku.0.2021.06.07.10.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 10:55:59 -0700 (PDT) From: Leah Rumancik To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, dan.carpenter@oracle.com, Leah Rumancik , kernel test robot Subject: [PATCH] ext4: fix input checking in fs/jbd2/journal.c Date: Mon, 7 Jun 2021 17:55:58 +0000 Message-Id: <20210607175558.3343945-1-leah.rumancik@gmail.com> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Update if (JBD2_JOURNAL_FLUSH_DISCARD & !blk_queue_discard(q)) to use && instead of &. JBD2_JOURNAL_FLUSH_DISCARD is set to 1 so & technically works but && could be a bit faster and will maintain correctness in the event the value of JBD2_JOURNAL_FLUSH_DISCARD is updated. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Leah Rumancik --- fs/jbd2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 521ce41c242c..f0636180b624 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1715,7 +1715,7 @@ static int __jbd2_journal_erase(journal_t *journal, unsigned int flags) if (!q) return -ENXIO; - if (JBD2_JOURNAL_FLUSH_DISCARD & !blk_queue_discard(q)) + if (JBD2_JOURNAL_FLUSH_DISCARD && !blk_queue_discard(q)) return -EOPNOTSUPP; /* -- 2.32.0.rc1.229.g3e70b5a671-goog