KernelNewbies:

Roel Kluin

Email: roel.kluin@gmail.com)

I wrote a few tools to do a multiline (git) grep, see [wiki:roelkluin/cvars_howto cvars howto]. To use these tools you first source [wiki:roelkluin/cvars cvars] and then do the searches in your git directory.

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 18:37:02 by d133062)