mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* cocci script for detecting alloc_apertures mem leak
@ 2018-02-01 16:29 Mathieu Malaterre
  2018-02-01 19:54 ` Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Malaterre @ 2018-02-01 16:29 UTC (permalink / raw)
  To: Julia Lawall, Gilles Muller, Nicolas Palix, Michal Marek, cocci,
	linux-kernel

Hi cocci gurus,

I am wondering if coccinelle can handle detection of kzalloc mem leak
(within alloc_apertures call) ? Typically:

$ cat drivers/video/fbdev/vesafb.c
static int vesafb_probe(struct platform_device *dev)
[...]
  info->apertures = alloc_apertures(1);

but then:

static void vesafb_destroy(struct fb_info *info)
{
  struct vesafb_par *par = info->par;

  fb_dealloc_cmap(&info->cmap);
  arch_phys_wc_del(par->wc_cookie);
  if (info->screen_base)
    iounmap(info->screen_base);
  release_mem_region(info->apertures->ranges[0].base,
info->apertures->ranges[0].size);
}

For reference:

$ cat include/linux/fb.h
static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
  struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
    + max_num * sizeof(struct aperture), GFP_KERNEL);


Thanks for comments,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-01 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 16:29 cocci script for detecting alloc_apertures mem leak Mathieu Malaterre
2018-02-01 19:54 ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®