diff options
| author | Yury Norov <ynorov@nvidia.com> | 2026-07-08 22:03:09 -0400 |
|---|---|---|
| committer | Yury Norov <ynorov@nvidia.com> | 2026-07-22 15:38:38 -0400 |
| commit | c69269f941b8c0c527ea2319556df0e21b8f3f52 (patch) | |
| tree | cc1ae3d554d2e9a1e220d65be9b9778c3d0ef13e /drivers/crypto | |
| parent | 6abf50fde2da0f8146fde313ae567277e562f1f9 (diff) | |
| download | linux-next-c69269f941b8c0c527ea2319556df0e21b8f3f52.tar.gz linux-next-c69269f941b8c0c527ea2319556df0e21b8f3f52.zip | |
crypto: ccp: Treat bitmap size as allocation failure
bitmap_find_next_zero_area() uses an out-of-range return value to
indicate failure. Accept only offsets strictly below the bitmap size so
the callers do not depend on the exact failure sentinel.
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Diffstat (limited to 'drivers/crypto')
| -rw-r--r-- | drivers/crypto/ccp/ccp-dev-v3.c | 2 | ||||
| -rw-r--r-- | drivers/crypto/ccp/ccp-dev-v5.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c index fe69053b2394..60a133e23e5f 100644 --- a/drivers/crypto/ccp/ccp-dev-v3.c +++ b/drivers/crypto/ccp/ccp-dev-v3.c @@ -28,7 +28,7 @@ static u32 ccp_alloc_ksb(struct ccp_cmd_queue *cmd_q, unsigned int count) ccp->sb_count, ccp->sb_start, count, 0); - if (start <= ccp->sb_count) { + if (start < ccp->sb_count) { bitmap_set(ccp->sb, start, count); mutex_unlock(&ccp->sb_mutex); diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index 7b73332d6aa1..dcd6aab51e47 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c @@ -47,7 +47,7 @@ static u32 ccp_lsb_alloc(struct ccp_cmd_queue *cmd_q, unsigned int count) MAX_LSB_CNT * LSB_SIZE, 0, count, 0); - if (start <= MAX_LSB_CNT * LSB_SIZE) { + if (start < MAX_LSB_CNT * LSB_SIZE) { bitmap_set(ccp->lsbmap, start, count); mutex_unlock(&ccp->sb_mutex); |
