From patchwork Mon Mar 13 22:27:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khazhy Kumykov X-Patchwork-Id: 13173399 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 A925CC76196 for ; Mon, 13 Mar 2023 22:30:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjCMWaC (ORCPT ); Mon, 13 Mar 2023 18:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229985AbjCMW37 (ORCPT ); Mon, 13 Mar 2023 18:29:59 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4D47EA33 for ; Mon, 13 Mar 2023 15:29:58 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id d13so3466901pjh.0 for ; Mon, 13 Mar 2023 15:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678746598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FXqMwWwZuspLZLvoXRZdl9+91DL98FHBt3BrpUMzrfc=; b=KnNT2FCspPV/5hiSse0cmreKXdTEhVxglNy0zyCJL8zolYeTFHlnZSoR3lwlSdUaHp S980fGvhkM/Xk7Ifiu+tfpbC8ynqXoOkEgS3kscUz1NPY6V5hOC2cOXM7Zyq3dAMwl2G IVgJYY4MbvSKvXR8NNhMQ/WmbNM67wpOi8oF0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678746598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FXqMwWwZuspLZLvoXRZdl9+91DL98FHBt3BrpUMzrfc=; b=cRPbqGbDeOQz9u5wUVM9IP7xcSHgwCqAeAN5jYOI93azmLNrASdqB8vb5M9joHNNn7 gIL6JcVTGaJiDXPpCqw4OpT9egWqP4sV4pKyPUCLfwS22sPATL+DAJmsxd7XzaCPHvDZ fGt6fvepk8jMyXV/9rAhM+91C91k9HawgZjBssbT7n8ocKl7UmHqZ1PqnB+EQdjrhoOH sBcQNdizthUBx8aShMkscYtCTxMqKlta0Kl9VUrrWFYayEHX2ZqKNLPA7d8hxTl3LUZ0 eiyjuDaJMUZ+QMfd1YghSKhnNGDUqayweqB64qd3XMujGN+j3xMNJIfFhvO7oJweezE0 SURQ== X-Gm-Message-State: AO0yUKWQgKuEgAID7wpKu5exCrDAogr+GKow7Q46eGnPZ2h0Dgq8+jpP ugYsdXT0egPedaL0rkN32RzOLw== X-Google-Smtp-Source: AK7set/znSADW30jufifevptgSTUlyVkYs+FwxwM/lLCmRtZrch2HNLXkgzES3kQLOqupqdTpAjLmA== X-Received: by 2002:a17:902:eccd:b0:19c:f232:21ca with SMTP id a13-20020a170902eccd00b0019cf23221camr45821624plh.3.1678746597972; Mon, 13 Mar 2023 15:29:57 -0700 (PDT) Received: from khazhy-linux.svl.corp.google.com ([2620:15c:2d4:203:157:b07d:930a:fb24]) by smtp.gmail.com with ESMTPSA id km8-20020a17090327c800b0019aa8149cb9sm352440plb.79.2023.03.13.15.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 15:29:57 -0700 (PDT) From: Khazhismel Kumykov X-Google-Original-From: Khazhismel Kumykov To: stable@vger.kernel.org Cc: linux-block@vger.kernel.org, Yu Kuai , Jan Kara , Jens Axboe , Sasha Levin , Khazhismel Kumykov Subject: [PATCH v5.10 4/5] block, bfq: replace 0/1 with false/true in bic apis Date: Mon, 13 Mar 2023 15:27:56 -0700 Message-Id: <20230313222757.1103179-5-khazhy@google.com> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230313222757.1103179-1-khazhy@google.com> References: <20230313222757.1103179-1-khazhy@google.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Yu Kuai [ Upstream commit 337366e02b370d2800110fbc99940f6ddddcbdfa ] Just to make the code a litter cleaner, there are no functional changes. Signed-off-by: Yu Kuai Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20221214033155.3455754-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Stable-dep-of: b600de2d7d3a ("block, bfq: fix uaf for bfqq in bic_set_bfqq()") Signed-off-by: Sasha Levin Signed-off-by: Khazhismel Kumykov --- block/bfq-cgroup.c | 8 ++++---- block/bfq-iosched.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index badb90352bf3..2f440b79183d 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -705,15 +705,15 @@ static void *__bfq_bic_change_cgroup(struct bfq_data *bfqd, struct bfq_io_cq *bic, struct bfq_group *bfqg) { - struct bfq_queue *async_bfqq = bic_to_bfqq(bic, 0); - struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1); + struct bfq_queue *async_bfqq = bic_to_bfqq(bic, false); + struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, true); struct bfq_entity *entity; if (async_bfqq) { entity = &async_bfqq->entity; if (entity->sched_data != &bfqg->sched_data) { - bic_set_bfqq(bic, NULL, 0); + bic_set_bfqq(bic, NULL, false); bfq_release_process_ref(bfqd, async_bfqq); } } @@ -749,7 +749,7 @@ static void *__bfq_bic_change_cgroup(struct bfq_data *bfqd, */ bfq_put_cooperator(sync_bfqq); bfq_release_process_ref(bfqd, sync_bfqq); - bic_set_bfqq(bic, NULL, 1); + bic_set_bfqq(bic, NULL, true); } } } diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 35b240cba092..016d7f32af9f 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2816,7 +2816,7 @@ bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic, /* * Merge queues (that is, let bic redirect its requests to new_bfqq) */ - bic_set_bfqq(bic, new_bfqq, 1); + bic_set_bfqq(bic, new_bfqq, true); bfq_mark_bfqq_coop(new_bfqq); /* * new_bfqq now belongs to at least two bics (it is a shared queue): @@ -6014,7 +6014,7 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq) return bfqq; } - bic_set_bfqq(bic, NULL, 1); + bic_set_bfqq(bic, NULL, true); bfq_put_cooperator(bfqq);