Skip to contentSkip to conversation

drm/i915: cleanup a min_t() cast

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 20, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: cleanup a min_t() cast

The lower layers of sysfs will not allow an "offset" of more than GEN7_L3LOG_SIZE and also l3_access_valid() caps it a second time. But it's a little easier to audit if we don't have to worry that the subtraction will result in negative values.

drivers/gpu/drm/i915/i915_sysfs.c +1 -1
index d572435..b3f62b4 100644
@@ -127,7 +127,7 @@ i915_l3_read(struct file *filp, struct kobject *kobj,
 	if (ret)
 		return ret;
 
-	count = min_t(int, GEN7_L3LOG_SIZE-offset, count);
+	count = min_t(size_t, GEN7_L3LOG_SIZE - offset, count);
 
 	ret = i915_mutex_lock_interruptible(drm_dev);
 	if (ret)
#1 lore raw
Quoted 6 lines · Dan Carpenter

The lower layers of sysfs will not allow an "offset" of more than GEN7_L3LOG_SIZE and also l3_access_valid() caps it a second time. But it's a little easier to audit if we don't have to worry that the subtraction will result in negative values.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch