From mboxrd@z Thu Jan 1 00:00:00 1970 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 0E369C433F5 for ; Thu, 7 Apr 2022 09:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243601AbiDGJES (ORCPT ); Thu, 7 Apr 2022 05:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243770AbiDGJDc (ORCPT ); Thu, 7 Apr 2022 05:03:32 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4913205A; Thu, 7 Apr 2022 02:01:31 -0700 (PDT) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 23743g5e001248; Thu, 7 Apr 2022 11:01:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=1ezUATS7YucgATnJzZ/8KE0ypMPsbEqbkpxpFXJwO8U=; b=3Ll0G2zY4iXhpM85f2y+tpuAkUiZ6MD+ymFHIxX5IdzbfmP9Rv2LnfP+hejpS+l/tsGx 0t8+fixaS+WItL/S+j7XXa0Yt+K/U7T+iBrUb2rz51bPN3vkg0IFzodk8NFSgdnKyE+e +rxyiWuAJh8OZ2+1p+5cgd9EB6gm6QrdTtuPL0a0z+k07TWVAvM8S+cyG6GLxoMv0Nc4 uEJmSTd3vkoDxAXOKJtKpfmOePhh+b1NTtDjobiwX190HbtdLnBzeXE9a7APjqgxLY/5 IUgldEdtq/qcdBNeiicTIZduR6tKo/Cw25+ODeHmxY+89tj9NGu8DPYtD28IUexIr9jY Kg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3f6du13hsv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Apr 2022 11:01:21 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B9A3B10002A; Thu, 7 Apr 2022 11:01:20 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9EE16215159; Thu, 7 Apr 2022 11:01:20 +0200 (CEST) Received: from [10.201.22.81] (10.75.127.51) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Thu, 7 Apr 2022 11:01:19 +0200 Message-ID: Date: Thu, 7 Apr 2022 11:01:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] stm: ltdc: fix two incorrect NULL checks on list iterator Content-Language: en-US To: Raphael Gallais-Pou , Xiaomeng Tong , CC: , , , , , , , , , References: <20220327055355.3808-1-xiam0nd.tong@gmail.com> From: Philippe CORNU In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE1.st.com (10.75.127.4) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-06_13,2022-04-06_01,2022-02-23_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/28/22 14:37, Raphael Gallais-Pou wrote: > Hello Xiaomeng > > On 3/27/22 07:53, Xiaomeng Tong wrote: >> The two bugs are here: >> if (encoder) { >> if (bridge && bridge->timings) >> >> The list iterator value 'encoder/bridge' will *always* be set and >> non-NULL by drm_for_each_encoder()/list_for_each_entry(), so it is >> incorrect to assume that the iterator value will be NULL if the >> list is empty or no element is found. >> >> To fix the bug, use a new variable '*_iter' as the list iterator, >> while use the old variable 'encoder/bridge' as a dedicated pointer >> to point to the found element. >> >> Cc: stable@vger.kernel.org >> Fixes: 99e360442f223 ("drm/stm: Fix bus_flags handling") >> Signed-off-by: Xiaomeng Tong >> --- >> drivers/gpu/drm/stm/ltdc.c | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) > > > Thanks for your fix > > Acked-by: Raphael Gallais-Pou > > > Raphaƫl Gallais-Pou > Applied on drm-misc-next. Many thanks for your patch, Philippe :-)