Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp654227iog; Thu, 30 Jun 2022 07:45:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ucjM5GqEmp0y9XiNe3+tQ0t6pliBbO5uZ0SwUelT5NJxw/83pjTWnnK0UCPOh8eydEcroW X-Received: by 2002:a17:906:f17:b0:6fe:94f6:cb8a with SMTP id z23-20020a1709060f1700b006fe94f6cb8amr9320313eji.456.1656600350462; Thu, 30 Jun 2022 07:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656600350; cv=none; d=google.com; s=arc-20160816; b=HUhdJROyXAXCNXp20QFr/idDocJqHw08ejAtWF8pLuv8MGwQvsR8pAOPVR2nqHwllR RY5smItTVYFsf2mFKNsLTXkNj9i7eavmbHaiZyWzalZvr4QvT64YYzbSXTz4gblw8Kha 497CQ4OmcsIYBVvBGUEgsoAQ8w9TADgdVxfGU6CCzy8cjcf9981OX/lRUcde1rGd1WYY L4E9AkxsS6tppVYfskGAqtzRSy3lk8gcqYrv3aaTtjiQyD18MJCjNVAfrgce+lRqYH2E X6LM+UHWwjBtu+lgxkDMW8OQBumobi9HV4p3GG5z0CNK9soHb58QTcTt5AlvCYlKuDNu i5fg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yti63KY5YmsjejxDQIb/6Sbs8yLaHvLvcxhR9mwyNzo=; b=PilhJf7Kdab3QnEHfHTlFduOTcGPPmxO1SaksAL+RfBg8mL5RzlEhBZKmjYSnko+CZ XSGEh/TAaG/gwFFMg4SGbgwXmePwTn4EX6mK6ypAinoEaWUFzuBct6G0CJHYgDjyEn09 AUKxi+Nis0EmjcsvRH2mIoOv6Oi9KNZ997czq2BEQb2aTmd9KGPTMrgr2T2toVkPD9Rn xFisWif0who+DpI2SW8CctfWVRMZYqxsPiFtsattahIv+Gx7Br//T9m6MmzZPHUi6Y8h S3ttbZgSZGhfhbf7QVIOUxyQMQgd7CxiAjdDFrcO3CSo5PQgTPJg6d+AWyg8u6MyL6ih +ITg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QDiZlK7K; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr30-20020a1709073f9e00b00711fa454fb3si23745264ejc.889.2022.06.30.07.45.23; Thu, 30 Jun 2022 07:45:50 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=QDiZlK7K; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236673AbiF3OJ1 (ORCPT + 99 others); Thu, 30 Jun 2022 10:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237019AbiF3OIF (ORCPT ); Thu, 30 Jun 2022 10:08:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B31476EB2; Thu, 30 Jun 2022 06:55:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD34C620F8; Thu, 30 Jun 2022 13:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7BEEC34115; Thu, 30 Jun 2022 13:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656597287; bh=QGJ+qIiXx7+zwSmR30+jI7MQIBBmK37LSTTM0Ila1B4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QDiZlK7KxD61VOuVBiqbfG2G2Kpp54zRquakDFey4Gm765xrhnthqeqW0r4MrMW1A 8Cn0a8loWltI0+opMAzE6+5eK56sKvwJmX25n5Rrh0qc0ZFSRIdCLs5+Hv1V8T4hZU dYW9sx+uVuDUzfd9YUO0d+AmeEYimLSRVky0geZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Jens Axboe Subject: [PATCH 5.15 04/28] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init() Date: Thu, 30 Jun 2022 15:47:00 +0200 Message-Id: <20220630133233.056392574@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220630133232.926711493@linuxfoundation.org> References: <20220630133232.926711493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Coly Li commit 7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c upstream. The local variables check_state (in bch_btree_check()) and state (in bch_sectors_dirty_init()) should be fully filled by 0, because before allocating them on stack, they were dynamically allocated by kzalloc(). Signed-off-by: Coly Li Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/btree.c | 1 + drivers/md/bcache/writeback.c | 1 + 2 files changed, 2 insertions(+) --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -2017,6 +2017,7 @@ int bch_btree_check(struct cache_set *c) if (c->root->level == 0) return 0; + memset(&check_state, 0, sizeof(struct btree_check_state)); check_state.c = c; check_state.total_threads = bch_btree_chkthread_nr(); check_state.key_idx = 0; --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -947,6 +947,7 @@ void bch_sectors_dirty_init(struct bcach return; } + memset(&state, 0, sizeof(struct bch_dirty_init_state)); state.c = c; state.d = d; state.total_threads = bch_btre_dirty_init_thread_nr();