From: Bart V. A. <bva...@ac...> - 2010-07-16 18:40:54
|
On Thu, Jul 15, 2010 at 9:16 PM, Vladislav Bolkhovitin <vs...@vl...> wrote: > > Bart Van Assche, on 07/11/2010 01:39 PM wrote: > [ ... ] >>>> --- iscsi-scst/kernel/digest.c (revision 1792) >>>> +++ iscsi-scst/kernel/digest.c (working copy) >>>> @@ -57,7 +57,7 @@ int digest_init(struct iscsi_conn *conn) >>>> return 0; >>>> } >>>> >>>> -static u32 evaluate_crc32_from_sg(struct scatterlist *sg, int nbytes, >>>> +static __le32 evaluate_crc32_from_sg(struct scatterlist *sg, int nbytes, >>>> uint32_t padding) >>> >>> For what is enforcing it to LE32? Crc32c() returns u32, so what are the >>> benefits of the additional conversion? >> >> The line "return ~cpu_to_le32(crc);" in evaluate_crc32_from_sg() makes its >> return value __le32. A possible alternative for all the changes in >> iscsi-scst/kernel/digest.c is to change that line into "return >> (__force u32)~cpu_to_le32(crc);". > > Hmm, I don't like it. Both hdigest and ddigest are in the network form (BE), > so, I think, we should use it as the starting point, not to pretend they both LE Sparse still reports two endianness warnings on r1828. These can be suppressed e.g. as follows: Index: iscsi-scst/kernel/iscsi.c =================================================================== --- iscsi-scst/kernel/iscsi.c (revision 1828) +++ iscsi-scst/kernel/iscsi.c (working copy) @@ -1664,7 +1664,7 @@ static int nop_out_start(struct iscsi_cm goto out; } - if (cmnd->pdu.bhs.itt == ISCSI_RESERVED_TAG_CPU32) { + if (cmnd->pdu.bhs.itt == ISCSI_RESERVED_TAG) { if (unlikely(!(cmnd->pdu.bhs.opcode & ISCSI_OP_IMMEDIATE))) PRINT_ERROR("%s", "Initiator sent RESERVED tag for " "non-immediate Nop-Out command"); Index: iscsi-scst/kernel/digest.c =================================================================== --- iscsi-scst/kernel/digest.c (revision 1828) +++ iscsi-scst/kernel/digest.c (working copy) @@ -82,7 +82,7 @@ static u32 evaluate_crc32_from_sg(struct crc = crc32c(crc, (u8 *)&padding, pad_bytes); #endif - return ~cpu_to_le32(crc); + return (__force __u32)~cpu_to_le32(crc); } static u32 digest_header(struct iscsi_pdu *pdu) |