KernelNewbies:

Roel Kluin

Email: roel.kluin@gmail.com)

I wrote a few tools to do a multiline (git-)grep. You have to source [wiki:roelkluin/cvars cvars] to use it. Do the searches in your git Linux kernel directory.

see [wiki:roelkluin/cvars_howto gres howto] for more examples.

Some functions' return codes should be audited, the scripts below searches for code sections where this lacks.

Z="request_region kmalloc vmalloc kzalloc scsi_register create_proc_entry"
for z in $Z; do
echo "---[ $z ]---"
gres -B1 -A20 "^((.* (@w) =)? (\( @V \** \) )*)? $z \(" \
"@Q2(\**@w) = (\**@w = )*(\( @V \** \) )* $z \(...\) ;.*
(return|[&|(]) (\1 [=\!]= NULL|\!? \1|NULL [=\!]= \1) [&|)?;]" \
"@Q2(\**@w = )+(\( @V \** \) )* $z \(...\) ;"
done | less

Z="request_irq register_netdev misc_register create_proc_profile kernel_thread do_fork"
for z in $Z; do
echo "---[ $z ]---"
gres -B1 -A20 "^((.* (@w) =)? (\( @V \** \) )*)? $z \(" \
"@Q2(\**@w) = (\**@w = )*(\( @V \** \) )* $z \(...\) ;.*
(return|[&|(]) (\1 (<|[\!>=]=) 0|\!? \1|0 (>|[\!<=]=) \1) [)&|?;]" \
"@Q2(\**@w = )+(\( @V \** \) )* $z \(...\) ;"
done | less

KernelNewbies: roelkluin (last edited 2009-12-28 17:01:05 by d133062)