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]
Date:	Wed, 31 Dec 2014 09:46:40 +0100 (CET)
From:	Fabian Frederick <fabf@...net.be>
To:	Joe Perches <joe@...ches.com>, Al Viro <viro@...IV.linux.org.uk>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Evgeniy Dushistov <dushistov@...l.ru>
Subject: Re: [PATCH 1/1] fs/ufs/super.c: remove unnecessary casting



> On 28 December 2014 at 19:21 Al Viro <viro@...IV.linux.org.uk> wrote:
>
>
> On Sun, Dec 28, 2014 at 08:45:44AM -0800, Joe Perches wrote:
> > On Sun, 2014-12-28 at 15:33 +0000, Al Viro wrote:
> > > On Sun, Dec 28, 2014 at 04:28:29PM +0100, Fabian Frederick wrote:
> > > > Fix the following coccinelle warning:
> > > > fs/ufs/super.c:1418:7-28: WARNING: casting value returned by memory
> > > > allocation function to (struct ufs_inode_info *) is useless.
> > >
> > > ... except that it makes allocations harder to grep for.
> >
> > How does it do that?
>
> search for \<struct[  ]*$NAME[        ]*($|[^         *]|[*][         ]*[)])
> generally gives a lot of interesting information (variables of that type,
> members of anything having that type, sizeof, container_of, explicit casts)
> with relatively little noise.
>
> BTW, that's why I really don't like the stuff like
>       struct foo *p = kmalloc(sizeof(*p), GFP_KERNEL);
> It's bloody hard to spot.
>
> In case of UFS we still catch "sizeof(struct ufs_inode_info)" in
>         ufs_inode_cachep = kmem_cache_create("ufs_inode_cache",
>                                              sizeof(struct ufs_inode_info),
>                                              0, (SLAB_RECLAIM_ACCOUNT|
>                                                 SLAB_MEM_SPREAD),
>                                              init_once);
> which gives the obvious secondary search pattern, so it's not _that_ terrible,
> but in general it's not something to do without thinking - such a cast could
> be placed there exactly to make it stand out on grep.

Thanks a lot for taking the time to explain the problem Al.
I'll be more careful next time.

Regards,
Fabian
--
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