Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfc: Remove checks for nla_data returning NULL

The implementation of nla_data is as follows:

static inline void *nla_data(const struct nlattr *nla)
{
return (char *) nla + NLA_HDRLEN;
}

Excluding the case where nla is exactly -NLA_HDRLEN, it will not return
NULL. And it seems misleading to assume that it can, other than in this
corner case. So drop checks for this condition.

Flagged by Smatch.

Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20250617-nfc-null-data-v1-1-c7525ead2e95@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Simon Horman and committed by
Jakub Kicinski
a9874d96 4f451b97

+1 -5
+1 -5
net/nfc/netlink.c
··· 1192 1192 continue; 1193 1193 1194 1194 uri = nla_data(sdp_attrs[NFC_SDP_ATTR_URI]); 1195 - if (uri == NULL || *uri == 0) 1195 + if (*uri == 0) 1196 1196 continue; 1197 1197 1198 1198 tid = local->sdreq_next_tid++; ··· 1540 1540 } 1541 1541 1542 1542 apdu = nla_data(info->attrs[NFC_ATTR_SE_APDU]); 1543 - if (!apdu) { 1544 - rc = -EINVAL; 1545 - goto put_dev; 1546 - } 1547 1543 1548 1544 ctx = kzalloc(sizeof(struct se_io_ctx), GFP_KERNEL); 1549 1545 if (!ctx) {