lkml.org 
[lkml]   [2014]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: sizeof (struct tYpO *) : it is just a typo or rather a bug ?
On 07/24/2014 08:33 PM, Ilya Dryomov wrote:
> On Thu, Jul 24, 2014 at 10:20 PM, Toralf Förster <toralf.foerster@gmx.de> wrote:
>> Inspired by this "typo" fix
>> http://article.gmane.org/gmane.linux.kernel/1754640
>> I grep'ed the current git tree of linus for similar issues.
>>
>> For these 4 places I'm wondering where the appropriate struct definition is located :
>>
>> arch/ia64/sn/kernel/io_acpi_init.c: sizeof(struct pci_devdev_info *)) {
>> tools/perf/builtin-sched.c: sched->tasks = realloc(sched->tasks, sched->nr_tasks * sizeof(struct task_task *));
>> fs/ceph/xattr.c: xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *),
>> fs/ceph/xattr.c: memset(xattrs, 0, numattr*sizeof(struct ceph_xattr *));
>
> Heh, the ceph one is a five year old typo.. Looks like it should be
> struct ceph_inode_xattr, I'll fix it up. I'm curious though, how did
> you grep for these?
>
> Thanks,
>
> Ilya
>

1:
grep -Hr "sizeof[ *(]struct .* \*.)" | cut -f2- -d':' | tee ~/tmp/out

2:
cat ~/tmp/out | perl -wane 'chomp(); my ($left, $right) = split (/sizeof\(/); print $right, "\n";' | cut -f2 -d' ' | sort -u | cut -f1 -d')' | grep -v '^+' | while read i; do echo $i; git grep -q "struct $i {" || echo error; echo; done

3:
ignore false positives

--
Toralf

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

\
 
 \ /
  Last update: 2014-07-24 21:21    [W:0.059 / U:1.124 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site