[ovs-git] Open vSwitch: bridge: Properly test for out-of-range values. (master)

dev at openvswitch.org dev at openvswitch.org
Mon Apr 18 17:35:15 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  b5a253896346849fdf515d0ed57fd3a2a9539753 (commit)
       via  5160ab34f8e97de8985d75d77c029324e4bccdab (commit)
       via  858f285284634a2933079cc6e68cc088c81cbe1d (commit)
      from  abf754896ee64d9a0319e70388afbcc177b3f9bd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b5a253896346849fdf515d0ed57fd3a2a9539753
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=b5a253896346849fdf515d0ed57fd3a2a9539753
Author: Ben Pfaff <blp at nicira.com>
		
bridge: Properly test for out-of-range values.
		
This code was trying to check for priorities greater than UINT16_MAX and
reset them, but it assigned the value to a uint16_t before it checked it,
which of course hid the problem.

Fixes the following GCC warning:

vswitchd/bridge.c:3034: warning: comparison is always false due to limited
range of data type

Reported-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>


commit 5160ab34f8e97de8985d75d77c029324e4bccdab
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=5160ab34f8e97de8985d75d77c029324e4bccdab
Author: Ben Pfaff <blp at nicira.com>
		
Avoid warnings about comparisons that are always true.
		
The range of "enum" types varies from one ABI to another.  If the enums
being tested in these functions happen to be 16 bits wide, then GCC may
issue a warning because, in such a case, the comparison is always true.

Using an int instead of a uint16_t avoids that particular problem and
should suppress the warning.

Fixes the following reported warnings:

lib/ofp-print.c:240: warning: comparison is always true due to limited
range of data type
lib/ofp-util.c:1973: warning: comparison is always false due to limited
range of data type

Reported-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>


commit 858f285284634a2933079cc6e68cc088c81cbe1d
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=858f285284634a2933079cc6e68cc088c81cbe1d
Author: Ben Pfaff <blp at nicira.com>
		
Fix calls to ctype functions.
		
The ctype functions often need casts to be fully C standards compliant.
Here's the full explanation that I used to post to comp.lang.c from time
to time when the issue came up:

    With the to*() and is*() functions, you should be careful to cast
    `char' arguments to `unsigned char' before calling them.  Type `char'
    may be signed or unsigned, depending on your compiler or its
    configuration.  If `char' is signed, then some characters have
    negative values; however, the arguments to is*() and to*() functions
    must be nonnegative (or EOF).  Casting to `unsigned char' fixes this
    problem by forcing the character to the corresponding positive value.

This fixes the following warnings from some version of GCC:

lib/ofp-parse.c:828: warning: array subscript has type 'char'
lib/ofp-print.c:617: warning: array subscript has type 'char'

Reported-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>


-----------------------------------------------------------------------

Summary of changes:
 AUTHORS           |    1 +
 lib/ofp-parse.c   |    3 ++-
 lib/ofp-print.c   |    6 +++---
 lib/ofp-util.c    |    7 +++----
 vswitchd/bridge.c |   16 +++++++++-------
 5 files changed, 18 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list