tls: Use size_add() in call to struct_size()
[platform/kernel/linux-rpi.git] / net / tls / tls_sw.c
index e9d1e83..9634dfd 100644 (file)
@@ -1491,7 +1491,7 @@ static int tls_decrypt_sg(struct sock *sk, struct iov_iter *out_iov,
         */
        aead_size = sizeof(*aead_req) + crypto_aead_reqsize(ctx->aead_recv);
        aead_size = ALIGN(aead_size, __alignof__(*dctx));
-       mem = kmalloc(aead_size + struct_size(dctx, sg, n_sgin + n_sgout),
+       mem = kmalloc(aead_size + struct_size(dctx, sg, size_add(n_sgin, n_sgout)),
                      sk->sk_allocation);
        if (!mem) {
                err = -ENOMEM;