On Wed, Jan 5, 2011 at 9:37 AM, Jeff Layton <[email protected]> wrote:
> If cifs.upcall is passed an invalid argument then it will "goto out".
> The decoded_args struct however is uninitialized at that point so it
> will usually segfault when trying to free fields in it. Move the
> initialization up in the function.
>
> Signed-off-by: Jeff Layton <[email protected]>
> ---
> cifs.upcall.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/cifs.upcall.c b/cifs.upcall.c
> index 1ffcd7c..34b0638 100644
> --- a/cifs.upcall.c
> +++ b/cifs.upcall.c
> @@ -677,6 +677,7 @@ int main(const int argc, char *const argv[])
> const char *oid;
>
> hostbuf[0] = '\0';
> + memset(&arg, 0, sizeof(arg));
>
> openlog(prog, 0, LOG_DAEMON);
>
> @@ -731,8 +732,6 @@ int main(const int argc, char *const argv[])
> goto out;
> }
>
> - memset(&arg, 0, sizeof(arg));
> -
> have = decode_key_description(buf, &arg);
> SAFE_FREE(buf);
> if ((have & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) {
> --
> 1.7.3.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Looks correct but something like would do the same (and save a memset call?)
struct decoded_args arg = {0};
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html