Merge branch 'fix-implicit-sign-conversions-in-handshake-upcall'
Chuck Lever says: ==================== Fix implicit sign conversions in handshake upcall An internal static analysis tool noticed some implicit sign conversions for some of the arguments in the handshake upcall protocol. ==================== Link: https://lore.kernel.org/r/169530154802.8905.2645661840284268222.stgit@oracle-102.nfsv4bat.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
35766690d6
@ -34,16 +34,16 @@ attribute-sets:
|
||||
attributes:
|
||||
-
|
||||
name: cert
|
||||
type: u32
|
||||
type: s32
|
||||
-
|
||||
name: privkey
|
||||
type: u32
|
||||
type: s32
|
||||
-
|
||||
name: accept
|
||||
attributes:
|
||||
-
|
||||
name: sockfd
|
||||
type: u32
|
||||
type: s32
|
||||
-
|
||||
name: handler-class
|
||||
type: u32
|
||||
@ -79,7 +79,7 @@ attribute-sets:
|
||||
type: u32
|
||||
-
|
||||
name: sockfd
|
||||
type: u32
|
||||
type: s32
|
||||
-
|
||||
name: remote-auth
|
||||
type: u32
|
||||
|
@ -18,7 +18,7 @@ static const struct nla_policy handshake_accept_nl_policy[HANDSHAKE_A_ACCEPT_HAN
|
||||
/* HANDSHAKE_CMD_DONE - do */
|
||||
static const struct nla_policy handshake_done_nl_policy[HANDSHAKE_A_DONE_REMOTE_AUTH + 1] = {
|
||||
[HANDSHAKE_A_DONE_STATUS] = { .type = NLA_U32, },
|
||||
[HANDSHAKE_A_DONE_SOCKFD] = { .type = NLA_U32, },
|
||||
[HANDSHAKE_A_DONE_SOCKFD] = { .type = NLA_S32, },
|
||||
[HANDSHAKE_A_DONE_REMOTE_AUTH] = { .type = NLA_U32, },
|
||||
};
|
||||
|
||||
|
@ -163,7 +163,7 @@ int handshake_nl_done_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
if (GENL_REQ_ATTR_CHECK(info, HANDSHAKE_A_DONE_SOCKFD))
|
||||
return -EINVAL;
|
||||
fd = nla_get_u32(info->attrs[HANDSHAKE_A_DONE_SOCKFD]);
|
||||
fd = nla_get_s32(info->attrs[HANDSHAKE_A_DONE_SOCKFD]);
|
||||
|
||||
sock = sockfd_lookup(fd, &err);
|
||||
if (!sock)
|
||||
|
@ -173,9 +173,9 @@ static int tls_handshake_put_certificate(struct sk_buff *msg,
|
||||
if (!entry_attr)
|
||||
return -EMSGSIZE;
|
||||
|
||||
if (nla_put_u32(msg, HANDSHAKE_A_X509_CERT,
|
||||
if (nla_put_s32(msg, HANDSHAKE_A_X509_CERT,
|
||||
treq->th_certificate) ||
|
||||
nla_put_u32(msg, HANDSHAKE_A_X509_PRIVKEY,
|
||||
nla_put_s32(msg, HANDSHAKE_A_X509_PRIVKEY,
|
||||
treq->th_privkey)) {
|
||||
nla_nest_cancel(msg, entry_attr);
|
||||
return -EMSGSIZE;
|
||||
@ -214,7 +214,7 @@ static int tls_handshake_accept(struct handshake_req *req,
|
||||
goto out_cancel;
|
||||
|
||||
ret = -EMSGSIZE;
|
||||
ret = nla_put_u32(msg, HANDSHAKE_A_ACCEPT_SOCKFD, fd);
|
||||
ret = nla_put_s32(msg, HANDSHAKE_A_ACCEPT_SOCKFD, fd);
|
||||
if (ret < 0)
|
||||
goto out_cancel;
|
||||
ret = nla_put_u32(msg, HANDSHAKE_A_ACCEPT_MESSAGE_TYPE, treq->th_type);
|
||||
|
@ -28,8 +28,8 @@ struct handshake_x509 {
|
||||
__u32 privkey:1;
|
||||
} _present;
|
||||
|
||||
__u32 cert;
|
||||
__u32 privkey;
|
||||
__s32 cert;
|
||||
__s32 privkey;
|
||||
};
|
||||
|
||||
/* ============== HANDSHAKE_CMD_ACCEPT ============== */
|
||||
@ -65,7 +65,7 @@ struct handshake_accept_rsp {
|
||||
__u32 peername_len;
|
||||
} _present;
|
||||
|
||||
__u32 sockfd;
|
||||
__s32 sockfd;
|
||||
enum handshake_msg_type message_type;
|
||||
__u32 timeout;
|
||||
enum handshake_auth auth_mode;
|
||||
@ -104,7 +104,7 @@ struct handshake_done_req {
|
||||
} _present;
|
||||
|
||||
__u32 status;
|
||||
__u32 sockfd;
|
||||
__s32 sockfd;
|
||||
unsigned int n_remote_auth;
|
||||
__u32 *remote_auth;
|
||||
};
|
||||
@ -122,7 +122,7 @@ handshake_done_req_set_status(struct handshake_done_req *req, __u32 status)
|
||||
req->status = status;
|
||||
}
|
||||
static inline void
|
||||
handshake_done_req_set_sockfd(struct handshake_done_req *req, __u32 sockfd)
|
||||
handshake_done_req_set_sockfd(struct handshake_done_req *req, __s32 sockfd)
|
||||
{
|
||||
req->_present.sockfd = 1;
|
||||
req->sockfd = sockfd;
|
||||
|
Loading…
x
Reference in New Issue
Block a user