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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120510141251.GA20471@kroah.com>
Date:	Thu, 10 May 2012 07:12:51 -0700
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	Minchan Kim <minchan@...nel.org>,
	Seth Jennings <sjenning@...ux.vnet.ibm.com>,
	Nitin Gupta <ngupta@...are.org>,
	Dan Magenheimer <dan.magenheimer@...cle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 3/4] zsmalloc use zs_handle instead of void *

On Thu, May 10, 2012 at 10:02:15AM -0400, Konrad Rzeszutek Wilk wrote:
> On Thu, May 10, 2012 at 11:03:19AM +0900, Minchan Kim wrote:
> > On 05/10/2012 05:19 AM, Greg Kroah-Hartman wrote:
> > 
> > > On Fri, May 04, 2012 at 11:24:54AM +0900, Minchan Kim wrote:
> > >> On 05/04/2012 12:23 AM, Seth Jennings wrote:
> > >>
> > >>> On 05/03/2012 08:32 AM, Nitin Gupta wrote:
> > >>>
> > >>>> On 5/3/12 2:40 AM, Minchan Kim wrote:
> > >>>>> We should use zs_handle instead of void * to avoid any
> > >>>>> confusion. Without this, users may just treat zs_malloc return value as
> > >>>>> a pointer and try to deference it.
> > >>>>>
> > >>>>> Cc: Dan Magenheimer<dan.magenheimer@...cle.com>
> > >>>>> Cc: Konrad Rzeszutek Wilk<konrad.wilk@...cle.com>
> > >>>>> Signed-off-by: Minchan Kim<minchan@...nel.org>
> > >>>>> ---
> > >>>>>   drivers/staging/zcache/zcache-main.c     |    8 ++++----
> > >>>>>   drivers/staging/zram/zram_drv.c          |    8 ++++----
> > >>>>>   drivers/staging/zram/zram_drv.h          |    2 +-
> > >>>>>   drivers/staging/zsmalloc/zsmalloc-main.c |   28
> > >>>>> ++++++++++++++--------------
> > >>>>>   drivers/staging/zsmalloc/zsmalloc.h      |   15 +++++++++++----
> > >>>>>   5 files changed, 34 insertions(+), 27 deletions(-)
> > >>>>
> > >>>> This was a long pending change. Thanks!
> > >>>
> > >>>
> > >>> The reason I hadn't done it before is that it introduces a checkpatch
> > >>> warning:
> > >>>
> > >>> WARNING: do not add new typedefs
> > >>> #303: FILE: drivers/staging/zsmalloc/zsmalloc.h:19:
> > >>> +typedef void * zs_handle;
> > >>>
> > >>
> > >>
> > >> Yes. I did it but I think we are (a) of chapter 5: Typedefs in Documentation/CodingStyle.
> > >>
> > >>  (a) totally opaque objects (where the typedef is actively used to _hide_
> > >>      what the object is).
> > >>
> > >> No?
> > > 
> > > No.
> > > 
> > > Don't add new typedefs to the kernel.  Just use a structure if you need
> > > to.
> > 
> > 
> > I tried it but failed because there were already tightly coupling between [zcache|zram]
> > and zsmalloc. 
> > They already knows handle's internal well so they used it as pointer, even zcache keeps
> > handle's value as some key in tmem_put and tmem_get
> > AFAIK, ramster also will use zsmalloc sooner or later and add more coupling codes. Sigh.
> > Please fix it as soon as possible.
> > 
> > Dan, Seth
> > Any ideas?
> 
> struct zs {
> 	void *ptr;
> };
> 
> And pass that structure around?

With a better name, that would be fine.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ