From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f51.google.com (mail-yx1-f51.google.com [74.125.224.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 970EB36C592 for ; Mon, 29 Jun 2026 12:01:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782734479; cv=none; b=QhUnYp7AeF/sORlWpGIy/YTTuXYinS3c1wjHwwHcB2kjQNspJ8lqOggjQ88V55X9ZZ9HPQZeGiGvNdp29AT058wcLtozZ/cnUjV3mXdnxJq28S2mKjUkJFKwqeOKG3LYXz+/6Wz10hk9o7zuaMHKZQstg98Zgwt/vSR1FPw3vmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782734479; c=relaxed/simple; bh=AtOW2j2S9kvd4HTKIsRDwYe6iNndoP0GStTxeQJEkvk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tFAnyjsPZJKF2yj/xlyLosM0mprDBQb99i8TK5PewAFmHxoDvKM4GR3ePp6mEuN5bVjr0z6l64xA9/IXzKJOUlVBFnc+ovEVJ7VNRTgsYk48NVJ+QKD9QG9pDYN28gD8OLFOm6RN260/CpDRE10QDwexkd7b3lzbOg7zdfOOToc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QlLy8HLT; arc=none smtp.client-ip=74.125.224.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QlLy8HLT" Received: by mail-yx1-f51.google.com with SMTP id 956f58d0204a3-664b84118d5so1474103d50.3 for ; Mon, 29 Jun 2026 05:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782734478; x=1783339278; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QT8i1Slk3yJGfD9XMmRDKAAJicTpOqFglW6PfHlcFSM=; b=QlLy8HLTshkOuhDFbEV0o0m/HAmm3TL3t3Yr34wzdSLHPuY/dMvXOHlgTHBafYHaCm VZXoy5Wq9njGWfe/JK1Js9ouRNZD29RlwdpIJOmNymKuEAufIn+82PrkFKArtVaihrnE aGfoE0JCzRBz8vA5LvbYdXNu5t28pAAmo3CczHOrK6hZsKaKxF2GoawwiKDFQ7EvZgYO /cSl1Mn8vcC/QEqBeLvc3mjKHsDLQ3FCV8hMlQXD8RM7CSXdjThVZxSI5Q18f3fCA3Oo A7u6epzuVSpFaItBlVwF2R9L07UZiCAg3efnqXSuWh1h/Ey9kGHqOMKaVmmKDvIfIQ7l +wgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782734478; x=1783339278; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QT8i1Slk3yJGfD9XMmRDKAAJicTpOqFglW6PfHlcFSM=; b=tKfJGtYEMzWBkTCCdp1QJ0cISPZDXyUtZ53WnITMNt5+bLFh2fC4Xtmg88FihY/cAI aIcoSuD68JwNancpol6mV2D7HWgUuOvJ4QNPs7+omrkFa49SZtfnL8ewzlkYyngX9bjM BYJwOSAPvNBYVV5r+D2qa4laHscOH0RKbbyPR2YQYRXPPCwt0ZQmnhvORfA5QTbOiKvR qqDzZ5IKqgSyPXTR752hdHn/lDWl2RKoNiGzgPsjYmzOpg9bc/4AqXthcj9N7Y43ae4E AmN0LOn9PEohiOxIWlQVRYPdeFU/wk6chwxf9T6r8gnQe7ALM2mM4/kOgtOUVw4uYOVx O6aw== X-Forwarded-Encrypted: i=1; AHgh+Rr6UfjzGHuRsVW0sEmV9/RBt6LyYJF9Yqo4WFgWj3CeBU3wMEYDkfsqcHQB0MDfw5IvZE0ir4aaVViHDI4=@vger.kernel.org X-Gm-Message-State: AOJu0YzBvfPjnk93Q9102om6q8PB0gSRRbqc143dZVJMg8aaLOuqy71K 3wGmpRPFDiP278sOSoLjtsUM3mJQyhxOFxkH9IGYuXswFYXik0nddhH6 X-Gm-Gg: AfdE7ckuvAbNMhUM30VGO7eqqmxFFhjI8y1PLNTiJrVQM+EssFG6SRyr0W90kWLg6iB QgkIsjhvx/zkGuKuEeUyIrJhwoX0h1Q2IKiHc3JJgBef6CfizWKmNt44TZfgfSwyouPEHt5uCj7 aHC7WZ9IrFlmcyVPIIjUOS777kBPXSy5hIbC+GhDoC/OBS8IvLPuN7SUejNPkRLqeeAKsJvHqID JWnwI9yyNA6+W2nXvLEKAkPZh2vUbzhJdn011X/hUPDhAtDIJL1+XEd6hR3PvhNTxh/MZHbBWHZ 5YnVbwrkA8Gx3zP2d80PvkbofK3bWfLFCUZdLBCRFh4cKtF4X92EPpYYRa2gUNGGuiNT7H4mmlI /3IzYXC84bi8dlV6smyR3mBLmgo2lagRtGFp5RklMmumovq4EhxXtZYOD/aNcjuB54SoBzw7mmm gudxE3Ng== X-Received: by 2002:a05:690e:4012:b0:663:5ffa:1671 with SMTP id 956f58d0204a3-664ac40f937mr9003702d50.44.1782734477503; Mon, 29 Jun 2026 05:01:17 -0700 (PDT) Received: from localhost ([74.80.182.100]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-664c061fda0sm2897859d50.9.2026.06.29.05.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2026 05:01:16 -0700 (PDT) Date: Mon, 29 Jun 2026 15:01:10 +0300 From: Dan Carpenter To: Andy Shevchenko Cc: Dawei Feng , hansg@kernel.org, mchehab@kernel.org, sakari.ailus@linux.intel.com, andy@kernel.org, gregkh@linuxfoundation.org, azpijr@gmail.com, kees@kernel.org, arnd@arndb.de, pontescpedro@gmail.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, jianhao.xu@seu.edu.cn, zilin@seu.edu.cn Subject: Re: [PATCH] media: atomisp: fix CAS scaler descriptor leaks Message-ID: References: <20260627060151.2543613-1-dawei.feng@seu.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jun 29, 2026 at 02:16:21PM +0300, Andy Shevchenko wrote: > On Mon, Jun 29, 2026 at 11:30:40AM +0300, Dan Carpenter wrote: > > On Sat, Jun 27, 2026 at 02:01:51PM +0800, Dawei Feng wrote: > > ... > > > free_output_stage: > > if (need_scalar) { > > kfree(mycs->is_output_stage); > > mycs->is_output_stage = NULL; > > } > > free_scalar_binary: > > if (need_scalar) { > > kfree(mycs->yuv_scaler_binary); > > mycs->yuv_scaler_binary = NULL; > > } > > If we go this way, double check that the checks are needed as we have kfree() > to be NULL-aware. Dawei, Andy is the one reviewing atomisp so his opinion matters more than mine here. So do what he says. But I don't really agree... In this case, sure, hopefully the caller zeroes the ->yuv_scaler_binary pointer, but if we just follow the simple rule of only undoing things which we have done then we don't need to check. The function is self contained and self explanatory. And more generally, I've always hated patches which delete NULL checks before a ionmap() or whatever. Hiding the NULL check inside the free function makes the code less self contained. The real fix is to stop mixing allocated and unallocated pointers. Then you don't need a NULL check because you already know. (Also I think those iounmap() patches were wrong because some arches have a warning when you unmap a NULL). regards, dan carpenter