Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1693228rdb; Mon, 8 Jan 2024 07:23:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxvVJAeLg2wCb4OF8q2wEWbfPmOAAD7ptoP4WbLa0lLRQ6EwQLv8mc1f8bw+jeUwyiFT6j X-Received: by 2002:a17:906:a898:b0:a2b:1ba9:873b with SMTP id ha24-20020a170906a89800b00a2b1ba9873bmr121598ejb.125.1704727427749; Mon, 08 Jan 2024 07:23:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704727427; cv=none; d=google.com; s=arc-20160816; b=kQu9kISnMQhRlcxqSpU/f16B0cwY1ZtuezzREMzWZ8i/RVXRBFMGzSICiCOGnFCiUY qGajPHTqwNPcF0Fg4W5H4y0w+A/L9bUR45sbu+BoBqkbSLHM+eWymMog5JDfPLMgCh/e 5KZvFGeYxdeeK49rlYHV0XHfMWhScAt76ShBEHGP5xuaGWzZdtE3oIAh5udSzyBH+xZj 05PuDE4d/k2jBFx6wLbAO7geWN/8w7I5lohTHa5tUAGh0xp1tpI+VFZ/Vr4+Z4j3SwcU NisxvMHdNYcTVt7wRcGiDbhScw0Drhl2DJ7SG3KcccQOWHZd6OlkrGFBuzkfcX4Knd1W veVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=PMnPyiIxKnwwZ9xj7j01B8RSJf6VRfzClWiMxY3uAxc=; fh=WkGH4FytrTfS96c2USGxwHyU1JYTq2yuL90RGwVnJ8s=; b=xf6qiYvND55WcxZbV0XnvOiPUfMiQ5rIaITJ0UdWcmOUvf7J6kQMP5tps8Dv8HSCoh k/+j2lUciJfqlaTojSl+wXBlaS6orP3TXUXNpGBL0pRTuzCStc34Mf1XE5eplUnk53gt xWSiRNI21kSzxJwjMyYIJW42VZqWE6cPxJ+8EvxHjEcK8/o+MKYDFY5w2yBb6o4FS4Y/ HuLO0diNB9jv395wrBqO9C/zRWG+f4nmml81R6V4WavsZ8Ga7Q6i88eFC9j9jJ2tarps 5ABEKo9+b4IVrb0QaoQQyUukuQJM+TEPDuIOWg9CkwWRUJ21FAk4mbDVjuIym0i3j2s0 yirA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UPW+uoMh; spf=pass (google.com: domain of linux-wireless+bounces-1589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ka18-20020a170907991200b00a2adda1c765si558939ejc.514.2024.01.08.07.23.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:23:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UPW+uoMh; spf=pass (google.com: domain of linux-wireless+bounces-1589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 817BB1F212E7 for ; Mon, 8 Jan 2024 15:23:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F18C44C623; Mon, 8 Jan 2024 15:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UPW+uoMh" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D87C94C610 for ; Mon, 8 Jan 2024 15:23:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DA20C433C7; Mon, 8 Jan 2024 15:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704727422; bh=+9HfResmFELxvjC7ij37IErxRXfh7YCjAMkpPlssfcY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=UPW+uoMh8+EuJZVXHmo/j4U7184c6YrnQegTL67nxf7ZUZaRReb6G+HGbab6wuX/s 1125JICvEhM8/xgeOgG+SzEfvZ7hMx5P0tlemtSgbwm/DGQNvJvEkmw2uUF7aOcbrq lPd9GXRJm6OvCvTdB43uJvjHWRUQ6drZwAmLt9kAVLJglKjkGq3ZSgqbQ/rhJ0tW56 S2phlG0fXxNEpzyFIltT58yJMVyV7BYAfzlu6INjhoeV5j64JBz5p8Ri3/D9WQirAr VrRh2i1gPaHiATwosBsNDvrH9K0upls+lEVY1oSuGCwqqV5No+OUdqBaAdPWC0q6dC o2dXa0QvwmnlA== From: Kalle Valo To: lilinmao Cc: "pkshih@realtek.com" , =?utf-8?Q?linux-wireless?= =?utf-8?Q?=40vger=2Ekern=E2=80=A6?= Subject: Re: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues References: <20240105104542.463834-1-lilinmao@kylinos.cn> <1704693852309064.667.seg@mailgw> <077A3848-0696-4DCC-99C3-DB5389EA2EA2@kylinos.cn> Date: Mon, 08 Jan 2024 17:23:39 +0200 In-Reply-To: <077A3848-0696-4DCC-99C3-DB5389EA2EA2@kylinos.cn> (lilinmao@kylinos.cn's message of "Mon, 8 Jan 2024 14:47:18 +0800") Message-ID: <87jzojetms.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain lilinmao writes: > I'm very sorry for the various issues encountered during my first patch submission. > > My patch didn't change the original logic of the code.Perhaps I just changed the way > of writing the code to avoid the cppcheck issue. > >>The original logic looks like >> >>bool found = false; >> >>for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) >>if (expr) { >>found = true; >>break; >>} >> >>if (!found) { >>... [A] >>} > > After the 'for' loop ends, 'if (idx > RTW89_IQK_CHS_NR - 1)' is > equivalent to 'if (!found). Cppcheck might not have detected the > changes to 'idx' within branch [A] which leads it to believe later > that 'idx' could be greater than or equal to 'RTW89_IQK_CHS_NR'. Our lists drop all html mail, so please use text/plain format and don't top post. More info in the wiki link below. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches