aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_debugfs.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-09-08 15:44:47 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-08 16:20:22 -0400
commitf4433a8d5d3076775bdd1a996a47db7beb468ac0 (patch)
tree383a5cdc743169e64b82e29614ecc498f12bffc5 /drivers/gpu/drm/i915/i915_debugfs.c
parent19966754328d99ee003ddfc7a8c31ceb115483ac (diff)
i915: snprintf returns large values
snprintf() returns the number of bytes which would have been used if there was enough space. It can be larger than the size of the buffer. Obviously in this case the buffer is large enough but everyone just copy and pastes this code so it's better to limit it and set a good example. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 2f3e017d24d6..7700ccf25784 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -886,6 +886,9 @@ i915_wedged_read(struct file *filp,
886 "wedged : %d\n", 886 "wedged : %d\n",
887 atomic_read(&dev_priv->mm.wedged)); 887 atomic_read(&dev_priv->mm.wedged));
888 888
889 if (len > sizeof (buf))
890 len = sizeof (buf);
891
889 return simple_read_from_buffer(ubuf, max, ppos, buf, len); 892 return simple_read_from_buffer(ubuf, max, ppos, buf, len);
890} 893}
891 894