net/iucv: updates 2020-10-01
Subsystems (4)
cover net/iucv: updates 2020-10-01
Hi Dave & Jakub,
please apply the following patch series for iucv to netdev's net-next tree.
Just two (rare) patches, and both deal with smatch warnings.
Thanks,
Julian
Julian Wiedmann (2):
net/af_iucv: right-size the uid variable in iucv_sock_bind() net/iucv: fix indentation in __iucv_message_receive()
net/iucv/af_iucv.c | 2 +- net/iucv/iucv.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 net/af_iucv: right-size the uid variable in iucv_sock_bind()
smatch complains aboutnet/iucv/af_iucv.c:624 iucv_sock_bind() error: memcpy() 'sa->siucv_user_id' too small (8 vs 9)
Which is absolutely correct - the memcpy() takes 9 bytes (sizeof(uid)) from an 8-byte field (sa->siucv_user_id).
Luckily the sockaddr_iucv struct contains more data after the .siucv_user_id field, and we checked the size of the passed data earlier on. So the memcpy() won't accidentally read from an invalid location.
Fix the warning by reducing the size of the uid variable to what's actually needed, and thus reducing the amount of copied data.
--- net/iucv/af_iucv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/iucv/af_iucv.c +1 -1
@@ -588,11 +588,11 @@ static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) {struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr; +char uid[sizeof (sa->siucv_user_id)];struct sock *sk = sock->sk;struct iucv_sock *iucv;int err =0 ;struct net_device *dev; -char uid[9 ];/* Verify the input sockaddr */ if (addr_len < sizeof(struct sockaddr_iucv) ||
Signature · 1 line
2.17.1
PATCH 2/2 net/iucv: fix indentation in __iucv_message_receive()
In reply to Julian Wiedmannsmatch complains aboutnet/iucv/iucv.c:1119 __iucv_message_receive() warn: inconsistent indenting
While touching this line, also make the return logic consistent and thus get rid of a goto label.
--- net/iucv/iucv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/iucv/iucv.c +3 -5
@@ -1116,10 +1116,9 @@ int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,if (msg->flags &IUCV_IPRMDATA )return iucv_message_receive_iprmdata (path, msg, flags, buffer, size, residual); -if (cpumask_empty (&iucv_buffer_cpumask)) { - rc = -EIO ; - goto out; - } +if (cpumask_empty (&iucv_buffer_cpumask)) +return -EIO ; + parm = iucv_param[smp_processor_id ()];memset (parm,0 ,sizeof (union iucv_param )); parm->db.ipbfadr1 = (u32 )(addr_t ) buffer;
@@ -1135,7 +1134,6 @@ int __iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,if (residual) *residual = parm->db.ipbfln1f; } -out:return rc; }EXPORT_SYMBOL (__iucv_message_receive);
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Julian Wiedmann <[email protected]>
Date: Thu, 1 Oct 2020 19:21:25 +0200
Quoted 4 lines
please apply the following patch series for iucv to netdev's net-next tree.
Just two (rare) patches, and both deal with smatch warnings.
Series applied, thanks.