Re: [PATCH] relay: fix potential memory leak
From: Andrew Morton
Date: Wed Jun 01 2016 - 22:11:35 EST
On Thu, 2 Jun 2016 09:24:04 +0800 (GMT+08:00) "Zhouyi Zhou" <yizhouzhou@xxxxxxxxx> wrote:
> Thanks Andrew for reviewing
> > > In addition, give warning to users who forget to provide create file
> > > hook.
> >
> > Why? What's the value in this?
> >
> > If the user didn't provide ->create_buf_file then setup_callbacks()
> > will provide them with create_buf_file_default_callback() - what's
> > wrong with that?
> >
> The beginners like me will probably call relay_open with base_filename
> and NULL callback or callback without create_buf_file hook. This call
> will fail in sub function relay_open_buf because
> create_buf_file_default_callback returns empty dentry. I guess it will
> be good to warn beginners to provide filesystem related create hooks at
> earlier stage or they fail without knowing what has happened.
There is no end to the code which we could add to help beginners! So
let's just fix the bug please, and we can discuss such development aids
separately.