These constants are ugly ...

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

 



Hi folks,

This use of constants seems ugly:

                /* make sure we have enough to get to the MID */
                if (pdu_length < HEADER_SIZE(server) - 1 - 4) {
                        cERROR(1, "SMB response too short (%u bytes)",
                                pdu_length);
                        cifs_reconnect(server);
                        wake_up(&server->response_q);
                        continue;
                }

While the 4 is obvious, the 1 is not, and would seem to lead to
getting all but one byte in the case of SMB2 headers.

Why can't HEADER_SIZE be MIN_HEADER_SIZE or something like that and be
defined in smb?ops.c as the appropriate thing? In the case of CIFS, it
would be sizeof(struct smb_hdr) - 1 and in the case of SMB2 it would
be sizeof(struct smb2_hdr).

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux