[v2,1/3] crypto: hisilicon/qm - increase the memory of local variables

Message ID 20221014100319.5259-2-yekai13@huawei.com
State New
Headers
Series crypto:hisilicon/qm - some misc-fixes by fuzz test |

Commit Message

yekai (A) Oct. 14, 2022, 10:03 a.m. UTC
  Increase the buffer to prevent stack overflow by fuzz test.

Signed-off-by: Kai Ye <yekai13@huawei.com>
---
 drivers/crypto/hisilicon/qm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Herbert Xu Oct. 21, 2022, 10:53 a.m. UTC | #1
On Fri, Oct 14, 2022 at 10:03:17AM +0000, Kai Ye wrote:
> Increase the buffer to prevent stack overflow by fuzz test.
> 
> Signed-off-by: Kai Ye <yekai13@huawei.com>
> ---
>  drivers/crypto/hisilicon/qm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
> index e3edb176d976..5d79e9f0e7e1 100644
> --- a/drivers/crypto/hisilicon/qm.c
> +++ b/drivers/crypto/hisilicon/qm.c
> @@ -250,7 +250,6 @@
>  #define QM_QOS_MIN_CIR_B		100
>  #define QM_QOS_MAX_CIR_U		6
>  #define QM_QOS_MAX_CIR_S		11
> -#define QM_QOS_VAL_MAX_LEN		32
>  #define QM_DFX_BASE		0x0100000
>  #define QM_DFX_STATE1		0x0104000
>  #define QM_DFX_STATE2		0x01040C8
> @@ -4612,7 +4611,7 @@ static ssize_t qm_get_qos_value(struct hisi_qm *qm, const char *buf,
>  			       unsigned int *fun_index)
>  {
>  	char tbuf_bdf[QM_DBG_READ_LEN] = {0};
> -	char val_buf[QM_QOS_VAL_MAX_LEN] = {0};
> +	char val_buf[QM_DBG_READ_LEN] = {0};

Please document how this value was derived in the patch log.

Thanks,
  

Patch

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index e3edb176d976..5d79e9f0e7e1 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -250,7 +250,6 @@ 
 #define QM_QOS_MIN_CIR_B		100
 #define QM_QOS_MAX_CIR_U		6
 #define QM_QOS_MAX_CIR_S		11
-#define QM_QOS_VAL_MAX_LEN		32
 #define QM_DFX_BASE		0x0100000
 #define QM_DFX_STATE1		0x0104000
 #define QM_DFX_STATE2		0x01040C8
@@ -4612,7 +4611,7 @@  static ssize_t qm_get_qos_value(struct hisi_qm *qm, const char *buf,
 			       unsigned int *fun_index)
 {
 	char tbuf_bdf[QM_DBG_READ_LEN] = {0};
-	char val_buf[QM_QOS_VAL_MAX_LEN] = {0};
+	char val_buf[QM_DBG_READ_LEN] = {0};
 	u32 tmp1, device, function;
 	int ret, bus;