net/tls: make allocation failure unlikely
authorJakub Kicinski <jakub.kicinski@netronome.com>
Mon, 7 Oct 2019 04:09:29 +0000 (21:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Oct 2019 13:58:27 +0000 (09:58 -0400)
Make sure GCC realizes it's unlikely that allocations will fail.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_device.c

index fcf38ed..23c19b8 100644 (file)
@@ -452,9 +452,8 @@ static int tls_push_data(struct sock *sk,
        max_open_record_len = TLS_MAX_PAYLOAD_SIZE +
                              prot->prepend_size;
        do {
-               rc = tls_do_allocation(sk, ctx, pfrag,
-                                      prot->prepend_size);
-               if (rc) {
+               rc = tls_do_allocation(sk, ctx, pfrag, prot->prepend_size);
+               if (unlikely(rc)) {
                        rc = sk_stream_wait_memory(sk, &timeo);
                        if (!rc)
                                continue;