Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4302712rdb; Thu, 28 Dec 2023 18:13:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5aUEi9tXhzXmcHZZkiCDekQWIatdUA/3yoNlYxZqSVRtQxRMXpMuEcnUemqoOaRbWienb X-Received: by 2002:a05:6870:d0c2:b0:204:130f:221a with SMTP id k2-20020a056870d0c200b00204130f221amr9318609oaa.99.1703815984392; Thu, 28 Dec 2023 18:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703815984; cv=none; d=google.com; s=arc-20160816; b=rZXX4udWlrfRtZ1hq+omZHaPJbLNhqRR+x0wUq1dLYZWkDaJ5H++KIVYHHMRyFNcWu SLX2vU1gevkkXthG81ZKxWOmlkgkhufj5NJuSOUn6MSN81Nrsd8RxQtI1QOXwzY3mpj+ xRibavGnHR24xLWUY7z0iMI2DgAvPPAZEqJvK5T53CcjSjhFSZCb/f698LuBf9w7ckFD voCgvbq3fWooVEAOddTTvkrbtygX0NkTACJIWdCV5p3A0d2Da3D3KulQmlQ/QoMrHNMS etfDtVf1BYkHcyXFBHVBYGFSwUL1FyttcDo0umPFqK8lxXMKOdQEFHMKiUNa21KE0M/C zvYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=McQR3+JUw7krSZxQe0JK6KcpNap9/xQT29xiP5x/JxA=; fh=T5SJWDA7ZBYIB+P+JJHsSesV1Y14QdszhdER/9gUlVU=; b=JohlLUW132JvuIH/y7E9adTv61HTVBjnqGdJMwKboIJQkH++PGMqwOyNT/5pAe14Tf Jn+7dNOEdiWRO3rlbcikR2GCj9uv5SMwtZxtJz4L49g6UzywKj5exyorYpsCzjFo4XaR nsYydQq/tHtjv7L+q5IytSHDtRsGIxFD9Z6otPlJ0fBytvHIX/C2Nk9sIchglNj+DH/k QRT8N5txoDWVxlA/8NBXukNqIljFVlTPHwxJ9fzNYo9zbGyaEIoKQYuYdAQ91SpGUAlT oDa+Z9eFcuVrgrMwBUBLcP5z3H45wQH+7Dc0ikocsC1Xabf9UQyug3to0gzBQ4D5fv3+ OR6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12910-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e6-20020a636906000000b005ce087e0043si9315900pgc.791.2023.12.28.18.13.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 18:13:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12910-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4A25AB23E3D for ; Fri, 29 Dec 2023 02:13:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AD8417D8; Fri, 29 Dec 2023 02:12:49 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.cecloud.com (unknown [1.203.97.240]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D75F1382; Fri, 29 Dec 2023 02:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cestc.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cestc.cn Received: from localhost (localhost [127.0.0.1]) by smtp.cecloud.com (Postfix) with ESMTP id 16AE0900112; Fri, 29 Dec 2023 10:12:37 +0800 (CST) X-MAIL-GRAY:0 X-MAIL-DELIVERY:1 X-ANTISPAM-LEVEL:2 X-ABS-CHECKED:0 Received: from localhost.localdomain (unknown [111.48.58.12]) by smtp.cecloud.com (postfix) whith ESMTP id P9456T281469140463984S1703815956124928_; Fri, 29 Dec 2023 10:12:37 +0800 (CST) X-IP-DOMAINF:1 X-RL-SENDER:liuwei09@cestc.cn X-SENDER:liuwei09@cestc.cn X-LOGIN-NAME:liuwei09@cestc.cn X-FST-TO:axboe@kernel.dk X-RCPT-COUNT:4 X-LOCAL-RCPT-COUNT:1 X-MUTI-DOMAIN-COUNT:0 X-SENDER-IP:111.48.58.12 X-ATTACHMENT-NUM:0 X-UNIQUE-TAG:<7c857e38d5f4d502005b6d183eaf34d0> X-System-Flag:0 From: Liu Wei To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, liuwei09@cestc.cn Subject: [PATCH] block/blk_mq: Only call kfree when set->tags isn't null Date: Fri, 29 Dec 2023 10:12:20 +0800 Message-ID: <20231229021220.7337-1-liuwei09@cestc.cn> X-Mailer: git-send-email 2.42.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In function blk_mq_realloc_tag_set_tags, there is a check on set->tags, but kfree should only be called when set->tags isn't null Signed-off-by: Liu Wei --- block/blk-mq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index ac18f802c027..07a3fc01d54b 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -4409,10 +4409,11 @@ static int blk_mq_realloc_tag_set_tags(struct blk_mq_tag_set *set, if (!new_tags) return -ENOMEM; - if (set->tags) + if (set->tags) { memcpy(new_tags, set->tags, set->nr_hw_queues * sizeof(*set->tags)); - kfree(set->tags); + kfree(set->tags); + } set->tags = new_tags; for (i = set->nr_hw_queues; i < new_nr_hw_queues; i++) { -- 2.42.1