Messages in this thread | | | Date | Sat, 19 Sep 2020 06:43:33 +0100 | From | Christoph Hellwig <> | Subject | Re: [PATCH 1/2] ethtool: improve compat ioctl handling |
| |
> + if (ethtool_translate_compat()) { > + struct compat_ethtool_rxnfc crxnfc = {}; > + > + if (copy_from_user(&crxnfc, useraddr, > + min(size, sizeof(crxnfc)))) > + return -EFAULT; > + > + *rxnfc = (struct ethtool_rxnfc) { > + .cmd = crxnfc.cmd, > + .flow_type = crxnfc.flow_type, > + .data = crxnfc.data, > + .fs = { > + .flow_type = crxnfc.fs.flow_type, > + .h_u = crxnfc.fs.h_u, > + .h_ext = crxnfc.fs.h_ext, > + .m_u = crxnfc.fs.m_u, > + .m_ext = crxnfc.fs.m_ext, > + .ring_cookie = crxnfc.fs.ring_cookie, > + .location = crxnfc.fs.location, > + }, > + .rule_cnt = crxnfc.rule_cnt, > + };
I'd split the compat version into a self-contained noinline helper. Same for ethtool_rxnfc_copy_to_user.
Otherwise this looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
| |