From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Gabriel Laskar <gabriel@lse.epita.fr>
Cc: intel-gfx@lists.freedesktop.org, strace-devel@lists.sourceforge.net
Subject: Re: [PATCH 4/4] drm: Add decoding of DRM and KMS ioctls
Date: Wed, 10 Jun 2015 01:55:49 +0300 [thread overview]
Message-ID: <20150609225549.GD3210@altlinux.org> (raw)
In-Reply-To: <20150609163840.077f240d@guiness.lab.lse.epita.fr>
[-- Attachment #1.1: Type: text/plain, Size: 2072 bytes --]
On Tue, Jun 09, 2015 at 04:38:40PM +0200, Gabriel Laskar wrote:
> On Tue, 9 Jun 2015 16:29:31 +0200
> Patrik Jakobsson <patrik.jakobsson@linux.intel.com> wrote:
>
> > On Tue, Jun 09, 2015 at 03:51:08PM +0200, Gabriel Laskar wrote:
> > > On Tue, 9 Jun 2015 13:26:44 +0200
> > > Patrik Jakobsson <patrik.jakobsson@linux.intel.com> wrote:
> > >
> > > > This patch adds many of the DRM and KMS ioctls. The rest can be added as
> > > > needed.
> > > >
> > > > Signed-off-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
> > > > ---
> > > > drm.c | 519 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 519 insertions(+)
> > > >
> > > > diff --git a/drm.c b/drm.c
> > > > index fa98fb7..e550c34 100644
> > > > --- a/drm.c
> > > > +++ b/drm.c
> > > > @@ -82,6 +82,468 @@ int drm_is_driver(struct tcb *tcp, const char *name)
> > > > return strcmp(name, drv) == 0;
> > > > }
> > > >
> > > > +static int drm_version(struct tcb *tcp, const unsigned int code, long arg)
> > > > +{
> > > > + struct drm_version ver;
> > > > + char *name, *date, *desc;
> > > > + int ret;
> > > > +
> > > > + if (entering(tcp) || umove(tcp, arg, &ver))
> > > > + return 0;
> > > > +
> > > > + name = calloc(ver.name_len + 1, 1);
> > >
> > > We have some wrappers for that now, you can call xcalloc(), but it will
> > > die if this does not work. Your version have the advantage of not kill
> > > strace, and just not decode the argument.
> > >
> >
> > If ok I'll keep it as calloc? As you say, dying here is not really neccessary.
>
> Yeah, that was mostly me thinking out loud. Imho, I would keep the
> calloc(), but I don't know what Dmitry will prefer. Maybe for
> consistency, it should be better to have an xcalloc().
The general rule is to call xcalloc() if die_out_of_memory() is the best
way to handle the OOM condition. strace should neither attempt to
allocate arbitrary large chunks of memory specified by user input
nor die when such allocation requests fail.
--
ldv
[-- Attachment #1.2: Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-06-09 22:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 11:26 [PATCH 0/4] drm: Add decoding for DRM/KMS and i915 ioctls Patrik Jakobsson
2015-06-09 11:26 ` [PATCH 1/4] drm: Add config for detecting libdrm Patrik Jakobsson
2015-06-09 11:26 ` [PATCH 2/4] drm: Add dispatcher and driver identification for DRM Patrik Jakobsson
2015-06-09 13:51 ` Gabriel Laskar
2015-06-09 14:35 ` Patrik Jakobsson
[not found] ` <1433849204-4125-3-git-send-email-patrik.jakobsson-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-06-09 22:14 ` Dmitry V. Levin
2015-06-10 11:52 ` Patrik Jakobsson
2015-06-10 23:26 ` Dmitry V. Levin
2015-06-11 14:11 ` Patrik Jakobsson
2015-06-12 23:41 ` Dmitry V. Levin
2015-06-14 11:12 ` Patrik Jakobsson
2015-06-14 21:56 ` [Intel-gfx] " Dmitry V. Levin
2015-06-09 23:10 ` Dmitry V. Levin
[not found] ` <1433849204-4125-1-git-send-email-patrik.jakobsson-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-06-09 11:26 ` [PATCH 3/4] drm: Add decoding of i915 ioctls Patrik Jakobsson
2015-06-09 22:35 ` Dmitry V. Levin
2015-06-10 12:45 ` Patrik Jakobsson
2015-06-10 23:27 ` Dmitry V. Levin
2015-06-11 13:34 ` Patrik Jakobsson
2015-06-12 23:48 ` Dmitry V. Levin
2015-06-14 11:10 ` Patrik Jakobsson
2015-06-09 11:26 ` [PATCH 4/4] drm: Add decoding of DRM and KMS ioctls Patrik Jakobsson
2015-06-09 13:51 ` Gabriel Laskar
2015-06-09 14:29 ` Patrik Jakobsson
2015-06-09 14:38 ` Gabriel Laskar
2015-06-09 22:55 ` Dmitry V. Levin [this message]
2015-06-09 22:46 ` Dmitry V. Levin
2015-06-10 14:27 ` Patrik Jakobsson
2015-06-09 13:51 ` [PATCH 0/4] drm: Add decoding for DRM/KMS and i915 ioctls Gabriel Laskar
[not found] ` <20150609155105.77ac6a9a-krIL5v34lyW+8jMViQwUxmazZaUMDOZU@public.gmane.org>
2015-06-09 14:36 ` Patrik Jakobsson
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=20150609225549.GD3210@altlinux.org \
--to=ldv@altlinux.org \
--cc=gabriel@lse.epita.fr \
--cc=intel-gfx@lists.freedesktop.org \
--cc=strace-devel@lists.sourceforge.net \
/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