bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small deadcode removal from dos.c (CoverityScan)


From: Pavel Raiskup
Subject: Small deadcode removal from dos.c (CoverityScan)
Date: Thu, 04 Aug 2011 11:10:41 +0200
User-agent: Opera Mail/11.50 (Linux)

Hi,

I would like to propose you a small patch for deadcode problem found by coverity.

Error message:

Error: DEADCODE:
/builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:693: dead_error_condition: On this path, the condition "sectors > 0LL" cannot be false. /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:686: between: After this line, the value of "sectors" is between 1 and 63. /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:686: assignment: Assigning: "sectors" = "head_size". /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:681: new_values: Noticing condition "head_size <= 63LL". /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:694: dead_error_line: Execution cannot reach this statement "return 0;".

Error: DEADCODE:
/builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:695: dead_error_condition: On this path, the condition "sectors <= 63LL" cannot be false. /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:693: between: After this line, the value of "sectors" is between 1 and 63. /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:686: assignment: Assigning: "sectors" = "head_size". /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:681: new_values: Noticing condition "head_size <= 63LL". /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:693: new_values: Noticing condition "sectors > 0LL". /builddir/build/BUILD/parted-2.1/libparted/labels/dos.c:696: dead_error_line: Execution cannot reach this statement "return 0;".

Coverity says it because the variable sectors is assigned by value of head_size which is checked some lines before for the same values.

Proposed fix is attached.

We are able to share this plain text coverity log so if you want to see whole log, let me know. It would be very appreciated when somebody could look at it.

Thanks,
Pavel

Attachment: 0001-Removed-dup-checks.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]