lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250403-elated-cinnamon-tortoise-7b6cb8@houat>
Date: Thu, 3 Apr 2025 09:04:28 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Christian König <christian.koenig@....com>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, 
	Sumit Semwal <sumit.semwal@...aro.org>, Benjamin Gaignard <benjamin.gaignard@...labora.com>, 
	Brian Starkey <Brian.Starkey@....com>, John Stultz <jstultz@...gle.com>, 
	"T.J. Mercier" <tjmercier@...gle.com>, Mattijs Korpershoek <mkorpershoek@...nel.org>, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, linux-media@...r.kernel.org, 
	dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH v2 1/2] dma-buf: heaps: system: Remove global variable

On Tue, Apr 01, 2025 at 05:28:43PM +0200, Christian König wrote:
> 
> 
> Am 01.04.25 um 17:12 schrieb Maxime Ripard:
> > The system heap has been using its struct dma_heap pointer but wasn't
> > using it anywhere.
> >
> > Since we'll need additional parameters to attach to that heap type,
> > let's create a private structure and set it as the dma_heap drvdata,
> > removing the global variable in the process.
> >
> > Signed-off-by: Maxime Ripard <mripard@...nel.org>
> > ---
> >  drivers/dma-buf/heaps/system_heap.c | 17 ++++++++++++-----
> >  1 file changed, 12 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c
> > index 26d5dc89ea1663a0d078e3a5723ca3d8d12b935f..adf422eaa33a52794f952d9d4260b8743d37f421 100644
> > --- a/drivers/dma-buf/heaps/system_heap.c
> > +++ b/drivers/dma-buf/heaps/system_heap.c
> > @@ -19,11 +19,13 @@
> >  #include <linux/module.h>
> >  #include <linux/scatterlist.h>
> >  #include <linux/slab.h>
> >  #include <linux/vmalloc.h>
> >  
> > -static struct dma_heap *sys_heap;
> > +struct system_heap {
> > +	struct dma_heap *heap;
> > +};
> >  
> >  struct system_heap_buffer {
> >  	struct dma_heap *heap;
> >  	struct list_head attachments;
> >  	struct mutex lock;
> > @@ -422,17 +424,22 @@ static const struct dma_heap_ops system_heap_ops = {
> >  };
> >  
> >  static int __init system_heap_create(void)
> >  {
> >  	struct dma_heap_export_info exp_info;
> > +	struct system_heap *sys_heap;
> > +
> > +	sys_heap = kzalloc(sizeof(*sys_heap), GFP_KERNEL);
> > +	if (!sys_heap)
> > +		return -ENOMEM;
> >  
> >  	exp_info.name = "system";
> >  	exp_info.ops = &system_heap_ops;
> > -	exp_info.priv = NULL;
> > +	exp_info.priv = sys_heap;
> 
> Why do you even need this?

Urgh, sorry. I'm not even sure how I ended up with that patch, but
you're correct. I'll send a much simpler version.

Maxime

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ