Re: [PATCH 4/4] drm: Add decoding of DRM and KMS ioctls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 10, 2015 at 01:46:53AM +0300, Dmitry V. Levin wrote:
> On Tue, Jun 09, 2015 at 01:26:44PM +0200, Patrik Jakobsson wrote:
> [...]
> > +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);
> > +	if (!name)
> > +		return 0;
> > +	ret = umovestr(tcp, (long)ver.name, ver.name_len, name);
> > +	if (ret < 0)
> > +		goto free_name;
> 
> No need to allocate (arbitrary sized chunk of) memory just to fetch
> a string that has to be printed.  There is a function called printstr()
> to print such strings in a properly quoted form.
> 

Yes, that's much nicer. Fixed in v2.

> 
> -- 
> ldv


_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux