regmap: debugfs: Don't bother actually printing when calculating max length
authorMark Brown <broonie@kernel.org>
Sat, 19 Sep 2015 14:12:34 +0000 (07:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:37:51 +0000 (14:37 -0700)
commit0bdf7953e7c97de5100d5f4ecad7a5d0c760503c
tree802c06554f1d9c71b5e0f10f7614aa7fc3421a3f
parent789ef3db34ad5bbb3660dd7cf16810974021f9f1
regmap: debugfs: Don't bother actually printing when calculating max length

commit 176fc2d5770a0990eebff903ba680d2edd32e718 upstream.

The in kernel snprintf() will conveniently return the actual length of
the printed string even if not given an output beffer at all so just do
that rather than relying on the user to pass in a suitable buffer,
ensuring that we don't need to worry if the buffer was truncated due to
the size of the buffer passed in.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/regmap/regmap-debugfs.c