Re: [PATCH 02/14] drm/i915/gvt: simplify vgpu configuration management

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

 



On Mon, Jul 04, 2022 at 11:15:36AM -0300, Jason Gunthorpe wrote:
> > +		if (conf->weight < 1 || conf->weight > VGPU_MAX_WEIGHT)
> >  			goto out_free_types;
> 
> This is now clearly impossible right? Maybe a BUILD_BUG_ON is all that
> is needed:

It is not possible right now, but an incorrect addition to the array
can easily add the condition.  A BUILD_BUG_ON would be nice, but my
gcc doesn't see the expressons as const enough for that to actually work.

> 
>   #define VGPU_WEIGHT(vgpu_num)	\
>          (VGPU_MAX_WEIGHT + BUILD_BUG_ON_ZERO((vgpu_num) > VGPU_MAX_WEIGHT) / (vgpu_num))
> 
> > +		sprintf(gvt->types[i].name, "GVTg_V%u_%s",
> > +			GRAPHICS_VER(gvt->gt->i915) == 8 ? 4 : 5, conf->name);
> > +		gvt->types->conf = conf;
> > +		gvt->types[i].avail_instance = min(low_avail / conf->low_mm,
> > +						   high_avail / conf->high_mm);
> 
> snprintf and check for failure?

I'd rather just leave it as-is. intead of messing with these unrelated
bit.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux