linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bluez@logic8.org
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] mesh: Fix check for MAX_APP_KEYS
Date: Mon, 5 Nov 2018 21:29:53 +0100	[thread overview]
Message-ID: <0672e88c-227e-aad4-48a0-ae482a92a970@logic8.org> (raw)

appkey_key_add() checks if the number of known appkeys is smaller or equal than MAX_APP_KEYS, but it should check if it is equal or larger than MAX_APP_KEYS.
---
 mesh/appkey.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mesh/appkey.c b/mesh/appkey.c
index 2ddb1eb..7578118 100644
--- a/mesh/appkey.c
+++ b/mesh/appkey.c
@@ -398,7 +398,7 @@ int appkey_key_add(struct mesh_net *net, uint16_t net_idx, uint16_t app_idx,
        }
 
        if (!key) {
-               if (l_queue_length(app_keys) <= MAX_APP_KEYS)
+               if (l_queue_length(app_keys) >= MAX_APP_KEYS)
                        return MESH_STATUS_INSUFF_RESOURCES;
 
                key = app_key_new();

                 reply	other threads:[~2018-11-05 20:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0672e88c-227e-aad4-48a0-ae482a92a970@logic8.org \
    --to=bluez@logic8.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).