* [PATCH] xfs: Use memset to initialize structure member.
@ 2012-02-24 7:08 santosh nayak
2012-02-24 7:53 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: santosh nayak @ 2012-02-24 7:08 UTC (permalink / raw)
To: bpm; +Cc: elder, xfs-masters, xfs, linux-kernel, kernel-janitors,
Santosh Nayak
From: Santosh Nayak <santoshprasadnayak@gmail.com>
Sparse is giving following warning:
fs/xfs/xfs_bmap.c:4826:41: warning: Using plain integer as NULL pointer.
To avoid this warning, use memset to initialize the structure member.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
---
fs/xfs/xfs_bmap.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 188ef2f..030e93f 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4823,7 +4823,7 @@ xfs_bmapi_write(
{
struct xfs_mount *mp = ip->i_mount;
struct xfs_ifork *ifp;
- struct xfs_bmalloca bma = { 0 }; /* args for xfs_bmap_alloc */
+ struct xfs_bmalloca bma; /* args for xfs_bmap_alloc */
xfs_fileoff_t end; /* end of mapped file region */
int eof; /* after the end of extents */
int error; /* error return */
@@ -4852,6 +4852,8 @@ xfs_bmapi_write(
ASSERT(!(flags & XFS_BMAPI_IGSTATE));
ASSERT(tp != NULL);
ASSERT(len > 0);
+
+ memset(&bma, 0, sizeof(bma));
whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
XFS_ATTR_FORK : XFS_DATA_FORK;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: Use memset to initialize structure member.
2012-02-24 7:08 [PATCH] xfs: Use memset to initialize structure member santosh nayak
@ 2012-02-24 7:53 ` Dan Carpenter
2012-02-24 16:05 ` Ben Myers
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-02-24 7:53 UTC (permalink / raw)
To: santosh nayak; +Cc: bpm, elder, xfs-masters, xfs, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
On Fri, Feb 24, 2012 at 12:38:42PM +0530, santosh nayak wrote:
> From: Santosh Nayak <santoshprasadnayak@gmail.com>
>
> Sparse is giving following warning:
> fs/xfs/xfs_bmap.c:4826:41: warning: Using plain integer as NULL pointer.
>
You could just do:
struct xfs_bmalloca bma = {};
But honestly, I'd just leave this one as is. The xfs people are
grumpy sorts and it's best to not send them these kinds of patches
that don't address a real bug.
regards,
dan
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: Use memset to initialize structure member.
2012-02-24 7:53 ` Dan Carpenter
@ 2012-02-24 16:05 ` Ben Myers
0 siblings, 0 replies; 3+ messages in thread
From: Ben Myers @ 2012-02-24 16:05 UTC (permalink / raw)
To: Dan Carpenter, santosh nayak
Cc: elder, kernel-janitors, linux-kernel, xfs, xfs-masters
Santosh,
On Fri, Feb 24, 2012 at 10:53:54AM +0300, Dan Carpenter wrote:
> On Fri, Feb 24, 2012 at 12:38:42PM +0530, santosh nayak wrote:
> > From: Santosh Nayak <santoshprasadnayak@gmail.com>
> >
> > Sparse is giving following warning:
> > fs/xfs/xfs_bmap.c:4826:41: warning: Using plain integer as NULL pointer.
> >
>
> You could just do:
> struct xfs_bmalloca bma = {};
This aggregate initializer seems cleaner than memset. Do you
mind resending the patch with Dan's suggestion?
Thanks for your contribution. ;)
-Ben
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-24 16:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24 7:08 [PATCH] xfs: Use memset to initialize structure member santosh nayak
2012-02-24 7:53 ` Dan Carpenter
2012-02-24 16:05 ` Ben Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).