Skip to content

Commit

Permalink
crypto: hisilicon/sec2 - fix some cleanup issues
Browse files Browse the repository at this point in the history
This patch fixes following cleanup issues:
 - The return value of the function is
   inconsistent with the actual return type.
 - After the pointer type is directly converted
   to the `__le64` type, the program may crash
   or produce unexpected results.

Signed-off-by: Qi Tao <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Qi Tao authored and herbertx committed Feb 2, 2024
1 parent c4af422 commit dd1a502
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/hisilicon/sec2/sec_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct sec_aead {
};

/* Get an en/de-cipher queue cyclically to balance load over queues of TFM */
static inline int sec_alloc_queue_id(struct sec_ctx *ctx, struct sec_req *req)
static inline u32 sec_alloc_queue_id(struct sec_ctx *ctx, struct sec_req *req)
{
if (req->c_req.encrypt)
return (u32)atomic_inc_return(&ctx->enc_qcyclic) %
Expand Down Expand Up @@ -1371,7 +1371,7 @@ static int sec_skcipher_bd_fill_v3(struct sec_ctx *ctx, struct sec_req *req)
sec_sqe3->bd_param = cpu_to_le32(bd_param);

sec_sqe3->c_len_ivin |= cpu_to_le32(c_req->c_len);
sec_sqe3->tag = cpu_to_le64(req);
sec_sqe3->tag = cpu_to_le64((unsigned long)req);

return 0;
}
Expand Down

0 comments on commit dd1a502

Please sign in to comment.