regmap: debugfs: Ensure we don't underflow when printing access masks
authorMark Brown <broonie@kernel.org>
Sat, 19 Sep 2015 14:00:18 +0000 (07:00 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 17 Nov 2015 15:54:40 +0000 (15:54 +0000)
commit9bd8029559877940f3f3b436f635794120ea3b2b
tree2f01fd4908cf5668c0848a7a047ec67de9e03a45
parent3895ff2d13043ecd091813b67a485ec487870b63
regmap: debugfs: Ensure we don't underflow when printing access masks

commit b763ec17ac762470eec5be8ebcc43e4f8b2c2b82 upstream.

If a read is attempted which is smaller than the line length then we may
underflow the subtraction we're doing with the unsigned size_t type so
move some of the calculation to be additions on the right hand side
instead in order to avoid this.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/base/regmap/regmap-debugfs.c