From: Daniel Vetter <daniel@ffwll.ch>
To: Jan Vesely <jan.vesely@rutgers.edu>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
DRI Development <dri-devel@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 4/4] xf86drm: Unconditionally clear ioctl structs
Date: Wed, 11 Feb 2015 17:21:54 +0100 [thread overview]
Message-ID: <20150211162154.GX24485@phenom.ffwll.local> (raw)
In-Reply-To: <1423670228.3926.52.camel@rutgers.edu>
On Wed, Feb 11, 2015 at 10:57:08AM -0500, Jan Vesely wrote:
> On Wed, 2015-02-11 at 12:42 +0100, Daniel Vetter wrote:
> > We really have to do this to avoid surprises when extending the ABI
> > later on. Especially when growing the structures.
> >
> > A bit overkill to update all the old legacy ioctl wrappers, but can't
> > hurt really either.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> > xf86drm.c | 112 ++++++++++++++++++++++++++++++++++++++++++--------------------
> > 1 file changed, 77 insertions(+), 35 deletions(-)
> >
> > diff --git a/xf86drm.c b/xf86drm.c
> > index 263d6835c29a..a2e24eb5f76c 100644
> > --- a/xf86drm.c
> > +++ b/xf86drm.c
> > @@ -89,6 +89,8 @@
> > #define DRM_NODE_PRIMARY 1
> > #define DRM_NODE_RENDER 2
> >
> > +#define memclear(s) memset(&s, 0, sizeof(s))
> > +
> > static drmServerInfoPtr drm_server_info;
> >
> > void drmSetServerInfo(drmServerInfoPtr info)
> > @@ -766,12 +768,7 @@ drmVersionPtr drmGetVersion(int fd)
> > drmVersionPtr retval;
> > drm_version_t *version = drmMalloc(sizeof(*version));
> >
> > - version->name_len = 0;
> > - version->name = NULL;
> > - version->date_len = 0;
> > - version->date = NULL;
> > - version->desc_len = 0;
> > - version->desc = NULL;
> > + memclear(version);
>
> I think this should be memclear(*version).
> Otherwise it clears the pointer not the structure.
Yeah ... and stupid me already pushed this :( I'll fix it up and have
another look at the patches to make sure I didn't botch another one.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-02-11 16:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 11:42 [PATCH 1/4] intel: Unconditionally clear ioctl structs Daniel Vetter
2015-02-11 11:42 ` [PATCH 2/4] xf86drmMode: " Daniel Vetter
2015-02-11 19:10 ` Ian Romanick
2015-02-11 11:42 ` [PATCH 3/4] drm: use drmIoctl everywhere Daniel Vetter
2015-02-11 12:21 ` Rob Clark
2015-02-11 13:13 ` Emil Velikov
2015-02-11 14:34 ` Daniel Vetter
2015-02-11 11:42 ` [PATCH 4/4] xf86drm: Unconditionally clear ioctl structs Daniel Vetter
2015-02-11 13:20 ` Emil Velikov
2015-02-11 15:57 ` Jan Vesely
2015-02-11 16:21 ` Daniel Vetter [this message]
2015-02-11 11:56 ` [PATCH] tests: remove intel-specific tests Daniel Vetter
2015-02-11 19:09 ` [PATCH 1/4] intel: Unconditionally clear ioctl structs Ian Romanick
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=20150211162154.GX24485@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jan.vesely@rutgers.edu \
/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.