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