All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Andrew Morton <akpm@linux-foundation.org>, Gang He <ghe@suse.com>,
	ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ocfs2: fix snprintf() checking
Date: Tue, 11 May 2021 16:52:29 +0300	[thread overview]
Message-ID: <20210511135229.GU1955@kadam> (raw)
In-Reply-To: <bd7ddc22-11c4-3e88-120a-d68f153f573d@linux.alibaba.com>

On Tue, May 11, 2021 at 08:54:53PM +0800, Joseph Qi wrote:
> 
> 
> On 5/11/21 3:16 PM, Dan Carpenter wrote:
> > The snprintf() function returns the number of bytes which would have
> > been printed if the buffer was large enough.  In other words it can
> > return ">= remain" but this code assumes it returns "== remain".
> > 
> > The run time impact of this bug is not very severe.  The next iteration
> > through the loop would trigger a WARN() when we pass a negative limit
> > to snprintf().  We would then return success instead of -E2BIG.
> > 
> > The kernel implementation of snprintf() will never return negatives so
> > there is no need to check and I have deleted that dead code.
> > 
> > Fixes: a860f6eb4c6a ("ocfs2: sysfile interfaces for online file check")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Looks good. But the last 2 sections are introduced by:
> 74ae4e104dfc ocfs2: Create stack glue sysfs files.
> 
> With 'Fixes' tag updated,
> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> 

Thanks!  Will do.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	ocfs2-devel@oss.oracle.com
Subject: Re: [Ocfs2-devel] [PATCH] ocfs2: fix snprintf() checking
Date: Tue, 11 May 2021 16:52:29 +0300	[thread overview]
Message-ID: <20210511135229.GU1955@kadam> (raw)
In-Reply-To: <bd7ddc22-11c4-3e88-120a-d68f153f573d@linux.alibaba.com>

On Tue, May 11, 2021 at 08:54:53PM +0800, Joseph Qi wrote:
> 
> 
> On 5/11/21 3:16 PM, Dan Carpenter wrote:
> > The snprintf() function returns the number of bytes which would have
> > been printed if the buffer was large enough.  In other words it can
> > return ">= remain" but this code assumes it returns "== remain".
> > 
> > The run time impact of this bug is not very severe.  The next iteration
> > through the loop would trigger a WARN() when we pass a negative limit
> > to snprintf().  We would then return success instead of -E2BIG.
> > 
> > The kernel implementation of snprintf() will never return negatives so
> > there is no need to check and I have deleted that dead code.
> > 
> > Fixes: a860f6eb4c6a ("ocfs2: sysfile interfaces for online file check")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Looks good. But the last 2 sections are introduced by:
> 74ae4e104dfc ocfs2: Create stack glue sysfs files.
> 
> With 'Fixes' tag updated,
> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> 

Thanks!  Will do.

regards,
dan carpenter


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

  reply	other threads:[~2021-05-11 13:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11  7:16 [PATCH] ocfs2: fix snprintf() checking Dan Carpenter
2021-05-11  7:16 ` [Ocfs2-devel] " Dan Carpenter
2021-05-11 12:54 ` Joseph Qi
2021-05-11 12:54   ` [Ocfs2-devel] " Joseph Qi
2021-05-11 13:52   ` Dan Carpenter [this message]
2021-05-11 13:52     ` Dan Carpenter
2021-05-11 13:53   ` [PATCH v2] " Dan Carpenter
2021-05-11 13:53     ` [Ocfs2-devel] " Dan Carpenter

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=20210511135229.GU1955@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=ghe@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@oss.oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.