Message ID | 20190701214914.8066-4-hauke@hauke-m.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | backports: Update for kernel 5.2 | expand |
diff --git a/backport/compat/backport-genetlink.c b/backport/compat/backport-genetlink.c index 885f1756..16971ec3 100644 --- a/backport/compat/backport-genetlink.c +++ b/backport/compat/backport-genetlink.c @@ -220,7 +220,11 @@ int backport_genl_register_family(struct genl_family *family) /* we append one entry to the ops to find our family pointer ... */ ops = kzalloc(sizeof(*ops) * (family->n_ops + 1), GFP_KERNEL); + if (!ops) + return -ENOMEM; + memcpy(ops, family->ops, sizeof(*ops) * family->n_ops); + /* * Remove policy to skip validation as the struct nla_policy * memory layout isn't compatible with the old version