Search Linux Wireless

NFC: smatch stuff: min_t() casting

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

 



Hi Sam,

Smatch complains about the min_t() casting here.

net/nfc/llcp/sock.c +80 llcp_sock_bind(44)
	warn: min_t truncates here '(llcp_addr.service_name_len)' (4294967295 vs 9223372036854775807)

    78          llcp_sock->local = local;
    79          llcp_sock->nfc_protocol = llcp_addr.nfc_protocol;
    80          llcp_sock->service_name_len = min_t(unsigned int,
    81                          llcp_addr.service_name_len, NFC_LLCP_MAX_SERVICE_NAME);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
Smatch complains that .service_name_len is a size_t (64 bits on 64 bit
architectures).  The cast to unsigned int takes the minimum of the
truncated value.

    82          llcp_sock->service_name = kmemdup(llcp_addr.service_name,
    83                                  llcp_sock->service_name_len, GFP_KERNEL);


These two functions are the same way.

net/nfc/llcp/sock.c +461 llcp_sock_connect(71)
	warn: min_t truncates here '(addr->service_name_len)' (4294967295 vs 9223372036854775807)
net/nfc/llcp/sock.c +521 llcp_sock_recvmsg(36) warn:
	min_t truncates here '(len)' (4294967295 vs 9223372036854775807)

It's not really an issue, but it's slightly untidy.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux