KernelNewbies:

Roel Kluin

Email: roel.kluin@gmail.com)

Usage: source [wiki:roelkluin/cvars cvars], goto your git Linux kernel directory and paste into the console:

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-09-21 14:28:56 by d133062)