summaryrefslogtreecommitdiffstats
path: root/net/tls
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2023-10-09 22:50:54 +0200
committerDavid S. Miller <davem@davemloft.net>2023-10-13 12:26:10 +0200
commit9f0c8245516bc30cff770c3a69a6baaf8eef8810 (patch)
tree5d634acd17e6e0cb130d50816fb1eefb90a1a39e /net/tls
parentchcr_ktls: use tls_offload_context_tx and driver_state like other drivers (diff)
downloadlinux-9f0c8245516bc30cff770c3a69a6baaf8eef8810.tar.xz
linux-9f0c8245516bc30cff770c3a69a6baaf8eef8810.zip
tls: use fixed size for tls_offload_context_{tx,rx}.driver_state
driver_state is a flex array, but is always allocated by the tls core to a fixed size (TLS_DRIVER_STATE_SIZE_{TX,RX}). Simplify the code by making that size explicit so that sizeof(struct tls_offload_context_{tx,rx}) works. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls')
-rw-r--r--net/tls/tls_device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index fe52765beaee..f01543557a60 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1038,7 +1038,7 @@ static struct tls_offload_context_tx *alloc_offload_ctx_tx(struct tls_context *c
struct tls_offload_context_tx *offload_ctx;
__be64 rcd_sn;
- offload_ctx = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_TX, GFP_KERNEL);
+ offload_ctx = kzalloc(sizeof(*offload_ctx), GFP_KERNEL);
if (!offload_ctx)
return NULL;
@@ -1225,7 +1225,7 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
goto release_lock;
}
- context = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_RX, GFP_KERNEL);
+ context = kzalloc(sizeof(*context), GFP_KERNEL);
if (!context) {
rc = -ENOMEM;
goto release_lock;