Skip to contentSkip to conversation

qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Qemu-devel dcb 1 participant 6 messages Jun 6, 2016 – Sep 2, 2016

lore
Share & tools
lore

dcb

author
#0 lore raw

Public bug reported:

qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing? qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

Source code is

    case 1:
        /* 10-byte CDB.  */
        r->cdb1 = req->cmd.buf[1];
        r->group_number = req->cmd.buf[6];
    case 4:
        /* 12-byte CDB.  */

Also,

[qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'. [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'. [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'. [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

** Affects: qemu
Importance: Undecided
Status: New

Signature · 32 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1589564

Title:
  qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Status in QEMU:
  New

Bug description:
  qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing?
  qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

  Source code is

      case 1:
          /* 10-byte CDB.  */
          r->cdb1 = req->cmd.buf[1];
          r->group_number = req->cmd.buf[6];
      case 4:
          /* 12-byte CDB.  */

  Also,

  [qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1589564/+subscriptions
author
#1 lore raw

The issue with the missing break has been fixed here:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=ed45cae39117d41315541

Signature · 32 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1589564

Title:
  qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Status in QEMU:
  New

Bug description:
  qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing?
  qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

  Source code is

      case 1:
          /* 10-byte CDB.  */
          r->cdb1 = req->cmd.buf[1];
          r->group_number = req->cmd.buf[6];
      case 4:
          /* 12-byte CDB.  */

  Also,

  [qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1589564/+subscriptions
author
#2 lore raw
In reply to dcb

I am currently not able to reproduce the problem with the format strings ... how did you get them? Which compiler (and version) did you use?

Signature · 32 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1589564

Title:
  qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Status in QEMU:
  New

Bug description:
  qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing?
  qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

  Source code is

      case 1:
          /* 10-byte CDB.  */
          r->cdb1 = req->cmd.buf[1];
          r->group_number = req->cmd.buf[6];
      case 4:
          /* 12-byte CDB.  */

  Also,

  [qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1589564/+subscriptions
author
#3 lore raw
In reply to dcb
Quoted 2 lines

I am currently not able to reproduce the problem with the format strings ... how did you get them? Which compiler (and version) did you use?

I used a static analyser for C & C++ called cppcheck. It is available from sourceforge. I find it very useful.

I think gcc might be able to reproduce these problems with one of the higher warning levels. -Wformat=2 springs to mind, but a check of the gcc documentation around -Wformat will give more accurate guidance.

Signature · 32 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1589564

Title:
  qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Status in QEMU:
  New

Bug description:
  qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing?
  qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

  Source code is

      case 1:
          /* 10-byte CDB.  */
          r->cdb1 = req->cmd.buf[1];
          r->group_number = req->cmd.buf[6];
      case 4:
          /* 12-byte CDB.  */

  Also,

  [qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1589564/+subscriptions
author
#4 lore raw
In reply to dcb

The issue with the format strings should now be fixed, too:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=142c21455bb2416b37f71b

** Changed in: qemu
Status: New => Fix Committed

Signature · 32 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1589564

Title:
  qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Status in QEMU:
  Fix Committed

Bug description:
  qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing?
  qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

  Source code is

      case 1:
          /* 10-byte CDB.  */
          r->cdb1 = req->cmd.buf[1];
          r->group_number = req->cmd.buf[6];
      case 4:
          /* 12-byte CDB.  */

  Also,

  [qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1589564/+subscriptions
author
#5 lore raw
In reply to dcb

** Changed in: qemu
Status: Fix Committed => Fix Released

Signature · 32 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1589564

Title:
  qemu/hw/scsi/scsi-disk.c:2741: possible missing break ?

Status in QEMU:
  Fix Released

Bug description:
  qemu/hw/scsi/scsi-disk.c:2741] -> [qemu/hw/scsi/scsi-disk.c:2745]: (warning) Variable 'cdb1' is reassigned a value before the old one has been used. 'break;' missing?
  qemu/hw/scsi/scsi-disk.c:2742] -> [qemu/hw/scsi/scsi-disk.c:2746]: (warning) Variable 'group_number' is reassigned a value before the old one has been used. 'break;' missing?

  Source code is

      case 1:
          /* 10-byte CDB.  */
          r->cdb1 = req->cmd.buf[1];
          r->group_number = req->cmd.buf[6];
      case 4:
          /* 12-byte CDB.  */

  Also,

  [qemu/hw/scsi/scsi-disk.c:2063]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2066]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2069]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
  [qemu/hw/scsi/scsi-disk.c:2083]: (warning) %lu in format string (no. 2) requires 'unsigned long' but the argument type is 'signed long'.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1589564/+subscriptions