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]
Date:	Mon, 11 Jul 2011 09:23:44 -0400
From:	David Teigland <teigland@...hat.com>
To:	"Dr. David Alan Gilbert" <linux@...blig.org>
Cc:	jj@...osbits.net, linux-kernel@...r.kernel.org
Subject: Re: kmallocs with swapped parameters in fs/dlm/lock.c

On Sun, Jul 10, 2011 at 01:30:32AM +0100, Dr. David Alan Gilbert wrote:
> Hi David,
>   Sparse spotted a couple of places in fs/dlm/lock.c where the size/flags
> parameters to kmalloc got swapped:
> 
> The sparse output is:
> fs/dlm/lock.c:852:42: warning: incorrect type in argument 1 (different base types)
> fs/dlm/lock.c:852:42:    expected unsigned long [unsigned] [usertype] size
> fs/dlm/lock.c:852:42:    got restricted gfp_t
> fs/dlm/lock.c:852:64: warning: incorrect type in argument 2 (different base types)
> fs/dlm/lock.c:852:64:    expected restricted gfp_t [usertype] flags
> fs/dlm/lock.c:852:64:    got unsigned long
> fs/dlm/lock.c:4136:27: warning: incorrect type in argument 1 (different base types)
> fs/dlm/lock.c:4136:27:    expected unsigned long [unsigned] [usertype] size
> fs/dlm/lock.c:4136:27:    got restricted gfp_t
> fs/dlm/lock.c:4136:39: warning: incorrect type in argument 2 (different base types)
> fs/dlm/lock.c:4136:39:    expected restricted gfp_t [usertype] flags
> fs/dlm/lock.c:4136:39:    got unsigned long
> 
> Line 852 is:
>                         warned = kmalloc(GFP_KERNEL, num_nodes * sizeof(int));
> Line 4136 is:
>         ms_stub = kmalloc(GFP_KERNEL, sizeof(struct dlm_message));
> 
> and at least one of the defs of kmalloc is:
> slab_def.h:static __always_inline void *kmalloc(size_t size, gfp_t flags)
> 
> Given that I haven't got a clue how to test a dlm, it's probably
> best that you patch it.
> 
> Jesper:
>   I noticed in your patch:
> https://lkml.org/lkml/2011/7/2/90
> 
> where you had done a kmalloc->kzalloc transform you kept the swap.
> 
> This looks like new code in 3.0rc so I don't think you could quite
> call it a regression, but it should probably be fixed fairly quickly
> I guess.

Thanks, I'll get that fixed.
Dave

--
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