mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Christine Caulfield <ccaulfie@redhat.com>,
	David Teigland <teigland@redhat.com>
Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
	Benny Halevy <bhalevy@panasas.com>
Subject: [PATCH] dlm: fix uninitialized variable for search_rsb_list callers
Date: Mon, 30 Jun 2008 19:59:14 +0300	[thread overview]
Message-ID: <1214845154-4978-1-git-send-email-bhalevy@panasas.com> (raw)

gcc 4.3.0 correctly emits the following warning.
search_rsb_list does not *r_ret if no dlm_rsb is found
and _search_rsb may pass the uninitialized value upstream
on the error path when both calls to search_rsb_list
return non-zero error.

The fix sets *r_ret to NULL on search_rsb_list's not-found path.

/usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/fs/dlm/lock.c: In function ‘_search_rsb’:
/usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/fs/dlm/lock.c:378: warning: ‘r’ may be used uninitialized in this function

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/dlm/lock.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 2d3d102..79c1d65 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -363,6 +363,7 @@ static int search_rsb_list(struct list_head *head, char *name, int len,
 		if (len == r->res_length && !memcmp(name, r->res_name, len))
 			goto found;
 	}
+	*r_ret = NULL;
 	return -EBADR;
 
  found:
-- 
1.5.6.GIT


             reply	other threads:[~2008-06-30 16:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30 16:59 Benny Halevy [this message]
2008-06-30 17:01 ` David Teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1214845154-4978-1-git-send-email-bhalevy@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=ccaulfie@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®