Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp651135iog; Thu, 30 Jun 2022 07:41:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6JnGKJHHbtjy5rrt78OkH4r7T1sQFuxnDFZoxlcG7RkESZpGKUT0e4duOAya4F8mwTqKM X-Received: by 2002:a05:6402:330d:b0:435:95ae:9b1e with SMTP id e13-20020a056402330d00b0043595ae9b1emr11797682eda.402.1656600117825; Thu, 30 Jun 2022 07:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656600117; cv=none; d=google.com; s=arc-20160816; b=ufws2gzyk9sl8x8LSuz2RCukRtU3RddxoOLYg3LRxl9q5+22oDbRXeAmpcmkwzR28z LfHg7u7IePEjEqpxPs0H8LNqxfuon3Vi5LHNzLoX7gechIYch+VDOCoXXVmwfAKq2Slr upuM08SO4fbrMXzbWCeGVGaiyQTiX001gVwpUC2LB917DqXXPA/DSbVns2RssvcoPsmF 7XH8GNeJY2HJFswVxsRu1OzKGtarxKDcwczIVfGesj2rIPMEsMeSLToinOVpSmFoVVHR D5wSKPV7gAap4LCpYyc+9xif7dJfggPgRigqQ/GJLK+4icoJ5NfValiIiEIvfv5ErWnv Q+Vw== 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=h0HbR0rQhw5cKqoir3//9JpE5/gdV7oNQqeZCZLbZ7I=; b=O25gwqhbSeMNz1bNhJNdycT6dEHlWUV3gQRn7t5dcEKgFzolD0EPJBcACHojHU8n9E 9TBoTlQGatsXv/nr3yPCBr2AaBJIpbzJr4TvilKKBFzSWtNRZmOftRuEjuN+hZzlM7z5 Z8Ex/8sz4fSRl65dhyL8nzm1jLIo0or853vEmuI3R65D+Fb5qsfyvSnOQq2TRCGPx/XY 958yAQzJ8e4IrvyMcONYccroahRLHZl8PDpVoO3GWwqWYkqSqyitJ4KVp2MbvRQS7HbF shEICRjhSpujtch7U+Dm86FJlz/VqjuI/lhcmxjmZLqWsCMkLtChHEt7T8XBjaTafuBr W4/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iDIju4ci; 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 ej13-20020a056402368d00b0043783a835aasi15862790edb.410.2022.06.30.07.41.33; Thu, 30 Jun 2022 07:41:57 -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=iDIju4ci; 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 S236536AbiF3OHM (ORCPT + 99 others); Thu, 30 Jun 2022 10:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236603AbiF3OGM (ORCPT ); Thu, 30 Jun 2022 10:06:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0484B6F34C; Thu, 30 Jun 2022 06:54:12 -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 F0EDC61FC0; Thu, 30 Jun 2022 13:54:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B85C34115; Thu, 30 Jun 2022 13:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656597251; bh=38FD9szrywuOziQywvQPvGcPzan/Dfw4GrYnqgtmQ+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iDIju4ciZVfP4ktnj5MxmxGUzotkqX/AXCAY14ZTe1sG7S7vcWI3L7qZ3A5ImkOIs 24YQUSOmgrfOjCqpiNtNUOcmR60Yg5muY7XehLGE4kaEYMVW/lG4wH1Qi+zzc/8wha vi2JdtpT7izU1s1+CCL2mqxmdK+XpRYJ0l31WCRs= 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.10 05/12] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init() Date: Thu, 30 Jun 2022 15:47:10 +0200 Message-Id: <20220630133230.843307110@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220630133230.676254336@linuxfoundation.org> References: <20220630133230.676254336@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 @@ -901,6 +901,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();