[Qemu-devel] [PULL 00/24] option cutils: Fix and clean up number conversions

Markus Armbruster posted 24 patches 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1487879642-16139-1-git-send-email-armbru@redhat.com
Test checkpatch failed
Test docker passed
Test s390x passed
hmp.c                  |  11 +-
hw/misc/ivshmem.c      |   9 +-
include/qemu/cutils.h  |  29 +--
monitor.c              |   7 +-
qapi/opts-visitor.c    |  11 +-
qemu-img.c             |  62 ++---
qemu-io-cmds.c         |  16 +-
qobject/qdict.c        |   2 +-
qtest.c                |  34 +--
target/i386/cpu.c      |   9 +-
tests/test-cutils.c    | 642 ++++++++++++++++++++++++++++++++-----------------
tests/test-qemu-opts.c | 324 ++++++++++++++++++++++++-
util/cutils.c          | 239 +++++++++---------
util/log.c             |   4 +-
util/qemu-option.c     |  87 +++----
15 files changed, 994 insertions(+), 492 deletions(-)
[Qemu-devel] [PULL 00/24] option cutils: Fix and clean up number conversions
Posted by Markus Armbruster 7 years, 1 month ago
QemuOpts has its own code to convert strings to numbers, and being
QemuOpts, it gets it wrong.  util/cutils is less wrong.  Fix it up
some, and reuse it for QemuOpts.

The following changes since commit 10f25e4844cb9b3f02fb032f88051dd5b65b4206:

  Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170222' into staging (2017-02-23 09:59:40 +0000)

are available in the git repository at:

  git://repo.or.cz/qemu/armbru.git tags/pull-util-2017-02-23

for you to fetch changes up to 75cdcd1553e74b5edc58aed23e3b2da8dabb1876:

  option: Fix checking of sizes for overflow and trailing crap (2017-02-23 20:35:36 +0100)

----------------------------------------------------------------
option cutils: Fix and clean up number conversions

----------------------------------------------------------------
Markus Armbruster (24):
      test-qemu-opts: Cover qemu_opts_parse()
      option: Assert value string isn't null
      test-cutils: Add missing qemu_strtol()... endptr checks
      test-cutils: Clean up qemu_strtoul() result checks
      util/cutils: Rewrite documentation of qemu_strtol() & friends
      util/cutils: Rename qemu_strtoll(), qemu_strtoull()
      util/cutils: Clean up variable names around qemu_strtol()
      util/cutils: Clean up control flow around qemu_strtol() a bit
      option: Fix to reject invalid and overflowing numbers
      test-cutils: Add missing qemu_strtosz()... endptr checks
      test-cutils: Cover qemu_strtosz() invalid input
      test-cutils: Cover qemu_strtosz() with trailing crap
      test-cutils: Cover qemu_strtosz() around range limits
      util/cutils: New qemu_strtosz_metric()
      util/cutils: Rename qemu_strtosz() to qemu_strtosz_MiB()
      util/cutils: New qemu_strtosz()
      util/cutils: Drop QEMU_STRTOSZ_DEFSUFFIX_* macros
      test-cutils: Use qemu_strtosz() more often
      test-cutils: Drop suffix from test_qemu_strtosz_simple()
      qemu-img: Wrap cvtnum() around qemu_strtosz()
      util/cutils: Let qemu_strtosz*() optionally reject trailing crap
      util/cutils: Return qemu_strtosz*() error and value separately
      util/cutils: Change qemu_strtosz*() from int64_t to uint64_t
      option: Fix checking of sizes for overflow and trailing crap

 hmp.c                  |  11 +-
 hw/misc/ivshmem.c      |   9 +-
 include/qemu/cutils.h  |  29 +--
 monitor.c              |   7 +-
 qapi/opts-visitor.c    |  11 +-
 qemu-img.c             |  62 ++---
 qemu-io-cmds.c         |  16 +-
 qobject/qdict.c        |   2 +-
 qtest.c                |  34 +--
 target/i386/cpu.c      |   9 +-
 tests/test-cutils.c    | 642 ++++++++++++++++++++++++++++++++-----------------
 tests/test-qemu-opts.c | 324 ++++++++++++++++++++++++-
 util/cutils.c          | 239 +++++++++---------
 util/log.c             |   4 +-
 util/qemu-option.c     |  87 +++----
 15 files changed, 994 insertions(+), 492 deletions(-)

-- 
2.7.4


Re: [Qemu-devel] [PULL 00/24] option cutils: Fix and clean up number conversions
Posted by no-reply@patchew.org 7 years, 1 month ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 1487879642-16139-1-git-send-email-armbru@redhat.com
Type: series
Subject: [Qemu-devel] [PULL 00/24] option cutils: Fix and clean up number conversions

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/1487879642-16139-1-git-send-email-armbru@redhat.com -> patchew/1487879642-16139-1-git-send-email-armbru@redhat.com
Switched to a new branch 'test'
6c2dc6b option: Fix checking of sizes for overflow and trailing crap
efb849e util/cutils: Change qemu_strtosz*() from int64_t to uint64_t
a3c2af8 util/cutils: Return qemu_strtosz*() error and value separately
e88e2c7 util/cutils: Let qemu_strtosz*() optionally reject trailing crap
ee039b6 qemu-img: Wrap cvtnum() around qemu_strtosz()
031b4f2 test-cutils: Drop suffix from test_qemu_strtosz_simple()
e59d8e6 test-cutils: Use qemu_strtosz() more often
693870b util/cutils: Drop QEMU_STRTOSZ_DEFSUFFIX_* macros
7878803 util/cutils: New qemu_strtosz()
0f70e58 util/cutils: Rename qemu_strtosz() to qemu_strtosz_MiB()
a8c80cd util/cutils: New qemu_strtosz_metric()
9f9041c test-cutils: Cover qemu_strtosz() around range limits
b6e3a34 test-cutils: Cover qemu_strtosz() with trailing crap
68347a8 test-cutils: Cover qemu_strtosz() invalid input
a54e5e3 test-cutils: Add missing qemu_strtosz()... endptr checks
5223692 option: Fix to reject invalid and overflowing numbers
3c3b278 util/cutils: Clean up control flow around qemu_strtol() a bit
f8fb787 util/cutils: Clean up variable names around qemu_strtol()
3f76906 util/cutils: Rename qemu_strtoll(), qemu_strtoull()
6caaa68 util/cutils: Rewrite documentation of qemu_strtol() & friends
a81892f test-cutils: Clean up qemu_strtoul() result checks
cc3ccd8 test-cutils: Add missing qemu_strtol()... endptr checks
06d7d7e option: Assert value string isn't null
5202d75 test-qemu-opts: Cover qemu_opts_parse()

=== OUTPUT BEGIN ===
Checking PATCH 1/24: test-qemu-opts: Cover qemu_opts_parse()...
Checking PATCH 2/24: option: Assert value string isn't null...
ERROR: consider using qemu_strtoull in preference to strtoull
#77: FILE: util/qemu-option.c:147:
+    number = strtoull(value, &postfix, 0);

total: 1 errors, 0 warnings, 117 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 3/24: test-cutils: Add missing qemu_strtol()... endptr checks...
Checking PATCH 4/24: test-cutils: Clean up qemu_strtoul() result checks...
Checking PATCH 5/24: util/cutils: Rewrite documentation of qemu_strtol() & friends...
Checking PATCH 6/24: util/cutils: Rename qemu_strtoll(), qemu_strtoull()...
Checking PATCH 7/24: util/cutils: Clean up variable names around qemu_strtol()...
ERROR: consider using qemu_strtol in preference to strtol
#78: FILE: util/cutils.c:316:
+        *result = strtol(nptr, &ep, base);

ERROR: consider using qemu_strtoul in preference to strtoul
#97: FILE: util/cutils.c:359:
+        *result = strtoul(nptr, &ep, base);

ERROR: consider using qemu_strtoll in preference to strtoll
#122: FILE: util/cutils.c:388:
+        *result = strtoll(nptr, &ep, base);

ERROR: consider using qemu_strtoull in preference to strtoull
#141: FILE: util/cutils.c:412:
+        *result = strtoull(nptr, &ep, base);

total: 4 errors, 0 warnings, 110 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 8/24: util/cutils: Clean up control flow around qemu_strtol() a bit...
ERROR: consider using qemu_strtol in preference to strtol
#83: FILE: util/cutils.c:322:
+    *result = strtol(nptr, &ep, base);

ERROR: consider using qemu_strtoul in preference to strtoul
#111: FILE: util/cutils.c:364:
+    *result = strtoul(nptr, &ep, base);

ERROR: consider using qemu_strtoll in preference to strtoll
#143: FILE: util/cutils.c:392:
+    *result = strtoll(nptr, &ep, base);

ERROR: consider using qemu_strtoull in preference to strtoull
#173: FILE: util/cutils.c:415:
+    *result = strtoull(nptr, &ep, base);

total: 4 errors, 0 warnings, 140 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 9/24: option: Fix to reject invalid and overflowing numbers...
Checking PATCH 10/24: test-cutils: Add missing qemu_strtosz()... endptr checks...
Checking PATCH 11/24: test-cutils: Cover qemu_strtosz() invalid input...
Checking PATCH 12/24: test-cutils: Cover qemu_strtosz() with trailing crap...
Checking PATCH 13/24: test-cutils: Cover qemu_strtosz() around range limits...
Checking PATCH 14/24: util/cutils: New qemu_strtosz_metric()...
Checking PATCH 15/24: util/cutils: Rename qemu_strtosz() to qemu_strtosz_MiB()...
Checking PATCH 16/24: util/cutils: New qemu_strtosz()...
Checking PATCH 17/24: util/cutils: Drop QEMU_STRTOSZ_DEFSUFFIX_* macros...
Checking PATCH 18/24: test-cutils: Use qemu_strtosz() more often...
Checking PATCH 19/24: test-cutils: Drop suffix from test_qemu_strtosz_simple()...
Checking PATCH 20/24: qemu-img: Wrap cvtnum() around qemu_strtosz()...
Checking PATCH 21/24: util/cutils: Let qemu_strtosz*() optionally reject trailing crap...
Checking PATCH 22/24: util/cutils: Return qemu_strtosz*() error and value separately...
Checking PATCH 23/24: util/cutils: Change qemu_strtosz*() from int64_t to uint64_t...
Checking PATCH 24/24: option: Fix checking of sizes for overflow and trailing crap...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PULL 00/24] option cutils: Fix and clean up number conversions
Posted by Peter Maydell 7 years, 1 month ago
On 23 February 2017 at 19:53, Markus Armbruster <armbru@redhat.com> wrote:
> QemuOpts has its own code to convert strings to numbers, and being
> QemuOpts, it gets it wrong.  util/cutils is less wrong.  Fix it up
> some, and reuse it for QemuOpts.
>
> The following changes since commit 10f25e4844cb9b3f02fb032f88051dd5b65b4206:
>
>   Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170222' into staging (2017-02-23 09:59:40 +0000)
>
> are available in the git repository at:
>
>   git://repo.or.cz/qemu/armbru.git tags/pull-util-2017-02-23
>
> for you to fetch changes up to 75cdcd1553e74b5edc58aed23e3b2da8dabb1876:
>
>   option: Fix checking of sizes for overflow and trailing crap (2017-02-23 20:35:36 +0100)
>
> ----------------------------------------------------------------
> option cutils: Fix and clean up number conversions
>

Applied, thanks.

-- PMM