60d877334f
Error handling code following a kmalloc should free the allocated data. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); ... if (x == NULL) S <... when != x when != if (...) { <+...x...+> } ( x->f1 = E | (x->f1 == NULL || ...) | f(...,x->f1,...) ) ...> ( return \(0\|<+...x...+>\|ptr\); | return@p2 ...; ) @script:python@ p1 << r.p1; p2 << r.p2; @@ print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Sage Weil <sage@newdream.net> |
||
---|---|---|
.. | ||
crush | ||
addr.c | ||
auth_none.c | ||
auth_none.h | ||
auth.c | ||
auth.h | ||
buffer.c | ||
buffer.h | ||
caps.c | ||
ceph_debug.h | ||
ceph_frag.c | ||
ceph_frag.h | ||
ceph_fs.c | ||
ceph_fs.h | ||
ceph_hash.c | ||
ceph_hash.h | ||
ceph_strings.c | ||
debugfs.c | ||
decode.h | ||
dir.c | ||
export.c | ||
file.c | ||
inode.c | ||
ioctl.c | ||
ioctl.h | ||
Kconfig | ||
Makefile | ||
mds_client.c | ||
mds_client.h | ||
mdsmap.c | ||
mdsmap.h | ||
messenger.c | ||
messenger.h | ||
mon_client.c | ||
mon_client.h | ||
msgpool.c | ||
msgpool.h | ||
msgr.h | ||
osd_client.c | ||
osd_client.h | ||
osdmap.c | ||
osdmap.h | ||
rados.h | ||
README | ||
snap.c | ||
super.c | ||
super.h | ||
types.h | ||
xattr.c |
# # The following files are shared by (and manually synchronized # between) the Ceph userland and kernel client. # # userland kernel src/include/ceph_fs.h fs/ceph/ceph_fs.h src/include/ceph_fs.cc fs/ceph/ceph_fs.c src/include/msgr.h fs/ceph/msgr.h src/include/rados.h fs/ceph/rados.h src/include/ceph_strings.cc fs/ceph/ceph_strings.c src/include/ceph_frag.h fs/ceph/ceph_frag.h src/include/ceph_frag.cc fs/ceph/ceph_frag.c src/include/ceph_hash.h fs/ceph/ceph_hash.h src/include/ceph_hash.cc fs/ceph/ceph_hash.c src/crush/crush.c fs/ceph/crush/crush.c src/crush/crush.h fs/ceph/crush/crush.h src/crush/mapper.c fs/ceph/crush/mapper.c src/crush/mapper.h fs/ceph/crush/mapper.h src/crush/hash.h fs/ceph/crush/hash.h src/crush/hash.c fs/ceph/crush/hash.c