Project

General

Profile

Bug #2562

Bug #1450: Illumos should be buildable with GCC4

FCoE iniator mistreats its ints

Added by Rich Lowe almost 9 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2012-03-29
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

The FCoE initiator sets specific bits by multiplication with the appropriate constant, rather than shifts (as everyone else would). This has the interesting side effect that bits on integer size boundaries are actually negative 0 (that is, 0x8000 is not unsigned). GCC notices this and quite fairly mentions that it's suspicious. We should set bits with shifts, like normal.

Further in fcoei_fill_els_fpkt_resp (what a name...) we do:

         prli_acc->image_pair_established =
             (FCOE_B2V_2(src + offset) & BIT_13) ? 1 : 0;
         prli_acc->accept_response_code =
            FCOE_B2V_2(src + offset) & 0x0F00;
         /*

response_code is 4 bits, and the RHS needs to be shifted 8 bits such that it fits.

Also available in: Atom PDF