lib/string_helpers: fix precision issues and introduce tests
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest4 patches 20 repliesIn review
- v23 patches 5 repliesSuperseded
- v13 patches 11 repliesSuperseded
Changes in v3 from the cover letter
- Separate blk_size check from Patch 3/4 to new Patch 2/4 [Andy Shevchenko]
- Slightly change the algorithm in Patch 3/4 [Rasmus Villemoes]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | lib/string_helpers: change blk_size to u32 for string_get_size() interfaceinclude/ lib/ | +3 | 12 replies | |
| 2/4 | lib/string_helpers.c: protect string_get_size() against blk_size=0lib/ | +5 | 6 replies | |
| 3/4 | lib/string_helpers.c: don't lose precision in string_get_size()lib/ | +14 | 1 reply | |
| 4/4 | lib/test-string_helpers.c: add string_get_size() testslib/ | +58 | 1 reply |
Reviews trailers per patch
1 of 4 patches has a Reviewed-by or Acked-by.
| Patch | Andy Shevchenko |
|---|---|
| 1/4 | |
| 2/4 | R-b |
| 3/4 | |
| 4/4 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/4] lib/string_helpers: fix precision issues and introduce tests
Linux always lies about your storage size when it has 4k sectors and its size is big enough. E.g. a device with 8192 4k sectors will be reported as "32.7 MB/32 MiB" while "33.5 MB/32 MiB" is expected. This series is supposed to fix the issue by fixing calculation precision in string_get_size() for all possible inputs.
PATCH 1/4 is a preparatory change, PATCH 2/4 adds additional protection against blk_size=0 (nobody is supposed to call string_get_size() with with blk_size=0, but better safe than sorry), PATCH 3/4 re-factors string_get_size() fixing the issue, PATCH 4/4 introduces tests for string_get_size().
PATCH 4/4 was previously sent as part of "lib/string_helpers.c: fix infinite loop in string_get_size()" series but it is still not merged upstream. In this submission I improve it and add additional tests to it.
Changes since v2:
- Separate blk_size check from Patch 3/4 to new Patch 2/4 [Andy Shevchenko]
- Slightly change the algorithm in Patch 3/4 [Rasmus Villemoes]
Vitaly Kuznetsov (4):
lib/string_helpers: change blk_size to u32 for string_get_size()
interface
lib/string_helpers.c: protect string_get_size() against blk_size=0 lib/string_helpers.c: don't lose precision in string_get_size() lib/test-string_helpers.c: add string_get_size() tests
include/linux/string_helpers.h | 2 +- lib/string_helpers.c | 38 ++++++++++++++------------- lib/test-string_helpers.c | 58 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 19 deletions(-)
Signature · 1 line
2.4.3