[PATCH 1/3] drm: Fix DRM_MINOR limits for control and render nodes

Ilija Hadzic ihadzic at research.bell-labs.com
Fri Sep 28 11:16:28 PDT 2012



On Fri, 28 Sep 2012, Kristian Høgsberg wrote:


  	if (type == DRM_MINOR_CONTROL) {
                  base += 64;
-                limit = base + 127;
+                limit = base + 64;
          } else if (type == DRM_MINOR_RENDER) {
                  base += 128;
-                limit = base + 255;
+                limit = base + 64;

If my first grade arithmetics serves me well, shouldn't limit in the first 
clause be base + 63 and in the second clause, base + 127. The render 
node starts at 128 and spans to 255, so there are total of 128 render 
nodes, 64 card (legacy) nodes and 64 control nodes allowed.

Actually, this construction of limit relative to the base does not achieve 
anything. The code would be much more readable if it were something like 
this:

 	if (type == DRM_MINOR_CONTROL) {
                 base = 64;
                 limit = 127;
         } else if (type == DRM_MINOR_RENDER) {
                 base = 128;
                 limit = 255;
         }

-- Ilija


More information about the dri-devel mailing list