public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Myers <bpm@sgi.com>
To: "Geyslan Gregório Bem" <geyslan@gmail.com>
Cc: Eric Sandeen <sandeen@sandeen.net>, Alex Elder <elder@kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	XFS FILESYSTEM <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: fix possible NULL dereference
Date: Wed, 23 Oct 2013 15:34:35 -0500	[thread overview]
Message-ID: <20131023203435.GR1935@sgi.com> (raw)
In-Reply-To: <CAGG-pUTtYomspBXn=RE7YFU=vu6rWZ1fU7CBO45Mmodj8DZFiQ@mail.gmail.com>

Hey Geyslan,

On Wed, Oct 23, 2013 at 08:58:51AM -0200, Geyslan Gregório Bem wrote:
> - Regarding the "possible new patch" subject, I humbly pass the ball to you.
> 
> Thank you for the attention.

Thank you for the patch.  I would really prefer to commit this showing
authorship from you, rather than a Reported-by.  Can I mark you down?

Regards,
	Ben

---

xfs: fix possible NULL dereference in xlog_verify_iclog

In xlog_verify_iclog a debug check of the incore log buffers prints an
error if icptr is null and then goes on to dereference the pointer
regardless.  Convert this to an assert so that the intention is clear.
This was reported by Coverty.

Reported-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
---
 fs/xfs/xfs_log.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Index: b/fs/xfs/xfs_log.c
===================================================================
--- a/fs/xfs/xfs_log.c	2013-10-23 14:52:47.875216875 -0500
+++ b/fs/xfs/xfs_log.c	2013-10-23 14:53:53.775245830 -0500
@@ -3714,11 +3714,9 @@ xlog_verify_iclog(
 	/* check validity of iclog pointers */
 	spin_lock(&log->l_icloglock);
 	icptr = log->l_iclog;
-	for (i=0; i < log->l_iclog_bufs; i++) {
-		if (icptr == NULL)
-			xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
-		icptr = icptr->ic_next;
-	}
+	for (i=0; i < log->l_iclog_bufs; i++, icptr = icptr->ic_next)
+      		ASSERT(icptr);
+
 	if (icptr != log->l_iclog)
 		xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__);
 	spin_unlock(&log->l_icloglock);


  reply	other threads:[~2013-10-23 20:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 18:32 [PATCH] xfs: fix possible NULL dereference Geyslan G. Bem
     [not found] ` <5265956F.4010700@sandeen.net>
2013-10-21 22:44   ` Dave Chinner
2013-10-21 23:12     ` Eric Sandeen
2013-10-21 23:18       ` Ben Myers
2013-10-21 23:56         ` Dave Chinner
2013-10-22  0:00           ` Eric Sandeen
2013-10-22  0:17             ` Dave Chinner
2013-10-22 10:12               ` Geyslan Gregório Bem
2013-10-22 20:39                 ` Dave Chinner
2013-10-22 20:49                   ` Eric Sandeen
2013-10-22 21:03                     ` Dave Chinner
2013-10-22 21:19                       ` Eric Sandeen
2013-10-22 22:02                         ` Dave Chinner
2013-10-22 22:33                           ` Ben Myers
2013-10-25  9:15                           ` Dave Jones
2013-10-23 10:58                         ` Geyslan Gregório Bem
2013-10-23 20:34                           ` Ben Myers [this message]
2013-10-23 20:53                             ` Geyslan Gregório Bem
2013-10-30 20:08                             ` Eric Sandeen
2013-10-31 15:55                               ` Ben Myers
2013-10-31 16:15                                 ` Geyslan Gregório Bem

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=20131023203435.GR1935@sgi.com \
    --to=bpm@sgi.com \
    --cc=elder@kernel.org \
    --cc=geyslan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.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