summaryrefslogtreecommitdiff
path: root/drivers/input/misc/yealink.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-09-21 18:48:05 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2012-09-21 18:48:05 (GMT)
commite05e279e6fc940a2adb9d4d4bf2b814dfc286176 (patch)
tree2dfeef2f02576933e752d1fb40e21d810e224a58 /drivers/input/misc/yealink.h
parent36048853c5257a7b6df346b83758ffa776a59e9f (diff)
downloadlinux-fsl-qoriq-e05e279e6fc940a2adb9d4d4bf2b814dfc286176.tar.xz
debugfs: fix u32_array race in format_array_alloc
The format_array_alloc() function is fundamentally racy, in that it prints the array twice: once to figure out how much space to allocate for the buffer, and the second time to actually print out the data. If any of the array contents changes in between, the allocation size may be wrong, and the end result may be truncated in odd ways. Just don't do it. Allocate a maximum-sized array up-front, and just format the array contents once. The only user of the u32_array interfaces is the Xen spinlock statistics code, and it has 31 entries in the arrays, so the maximum size really isn't that big, and the end result is much simpler code without the bug. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/input/misc/yealink.h')
0 files changed, 0 insertions, 0 deletions