copycount = count < msf->imsf_numsrc ? count : msf->imsf_numsrc;
len = flex_array_size(psl, sl_addr, copycount);
msf->imsf_numsrc = count;
- if (put_user(struct_size(optval, imsf_slist_flex, copycount), optlen) ||
- copy_to_user(optval, msf, struct_size(optval, imsf_slist_flex, 0))) {
+ if (put_user(IP_MSFILTER_SIZE(copycount), optlen) ||
+ copy_to_user(optval, msf, IP_MSFILTER_SIZE(0))) {
return -EFAULT;
}
if (len &&
struct sockaddr_in *psin;
int err, i;
- msf = kmalloc(struct_size(msf, imsf_slist_flex, numsrc), GFP_KERNEL);
+ msf = kmalloc(IP_MSFILTER_SIZE(numsrc), GFP_KERNEL);
if (!msf)
return -ENOBUFS;
{
struct ip_msfilter *msf;
- if (optlen < struct_size(msf, imsf_slist_flex, 0))
+ if (optlen < IP_MSFILTER_SIZE(0))
goto e_inval;
if (optlen > sysctl_optmem_max) {
err = -ENOBUFS;
err = -ENOBUFS;
break;
}
- if (struct_size(msf, imsf_slist_flex, msf->imsf_numsrc) >
- optlen) {
+ if (IP_MSFILTER_SIZE(msf->imsf_numsrc) > optlen) {
kfree(msf);
err = -EINVAL;
break;
{
struct ip_msfilter msf;
- if (len < struct_size(&msf, imsf_slist_flex, 0)) {
+ if (len < IP_MSFILTER_SIZE(0)) {
err = -EINVAL;
goto out;
}
- if (copy_from_user(&msf, optval,
- struct_size(&msf, imsf_slist_flex, 0))) {
+ if (copy_from_user(&msf, optval, IP_MSFILTER_SIZE(0))) {
err = -EFAULT;
goto out;
}