[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110829114041.6c1a0a4e@tlielax.poochiereds.net>
Date: Mon, 29 Aug 2011 11:40:41 -0400
From: Jeff Layton <jlayton@...hat.com>
To: Jesper Juhl <jj@...osbits.net>
Cc: Steve French <sfrench@...ba.org>, linux-cifs@...r.kernel.org,
samba-technical@...ts.samba.org, linux-kernel@...r.kernel.org,
trivial@...nel.org
Subject: Re: [PATCH][Trivial] CIFS: Don't free volume_info->UNC until we are
entirely done with it.
On Sat, 27 Aug 2011 18:58:34 +0200 (CEST)
Jesper Juhl <jj@...osbits.net> wrote:
> In cleanup_volume_info_contents() we kfree(volume_info->UNC); and then
> proceed to use that variable on the very next line.
> This causes (at least) Coverity Prevent to complain about use-after-free
> of that variable (and I guess other checkers may do that as well).
> There's not any /real/ problem here since we are just using the value of
> the pointer, not actually dereferencing it, but it's still trivial to
> silence the tool, so why not?
> To me at least it also just seems nicer to defer freeing the variable
> until we are entirely done with it in all respects.
>
> Signed-off-by: Jesper Juhl <jj@...osbits.net>
> ---
> fs/cifs/connect.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 633c246..9bb4b10 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2877,9 +2877,9 @@ cleanup_volume_info_contents(struct smb_vol *volume_info)
> {
> kfree(volume_info->username);
> kzfree(volume_info->password);
> - kfree(volume_info->UNC);
> if (volume_info->UNCip != volume_info->UNC + 2)
> kfree(volume_info->UNCip);
> + kfree(volume_info->UNC);
> kfree(volume_info->domainname);
> kfree(volume_info->iocharset);
> kfree(volume_info->prepath);
Seems reasonable for silencing the checker...
Reviewed-by: Jeff Layton <jlayton@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists