]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
regmap: debugfs: Avoid overflows for very small reads
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 10 Dec 2012 16:14:11 +0000 (01:14 +0900)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 3 Jan 2013 03:33:32 +0000 (03:33 +0000)
commit71f1e737a5ab8cc3c1384117222ef82c99bc056d
tree0869ca036b3e01d7efc00318a8a29d5c58775f8c
parent19afa7002ed6c2cf51c85ce5e2c2eaaf55e771c3
regmap: debugfs: Avoid overflows for very small reads

commit db04328c167ff8e7c57f4a3532214aeada3a82fd upstream.

If count is less than the size of a register then we may hit integer
wraparound when trying to move backwards to check if we're still in
the buffer. Instead move the position forwards to check if it's still
in the buffer, we are unlikely to be able to allocate a buffer
sufficiently big to overflow here.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
[bwh: Backported to 3.2: formatted length is tot_len]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/base/regmap/regmap-debugfs.c