Skip to content

Commit a361898

Browse files
Chenghai HuangSasha Levin
Chenghai Huang
authored and
Sasha Levin
committed
crypto: hisilicon/debugfs - fix the struct pointer incorrectly offset problem
commit cd26cd6 upstream. Offset based on (id * size) is wrong for sqc and cqc. (*sqc/*cqc + 1) can already offset sizeof(struct(Xqc)) length. Fixes: 15f112f ("crypto: hisilicon/debugfs - mask the unnecessary info from the dump") Cc: <stable@vger.kernel.org> Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3bb3f15 commit a361898

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/crypto/hisilicon/debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static int qm_sqc_dump(struct hisi_qm *qm, char *s, char *name)
192192

193193
down_read(&qm->qps_lock);
194194
if (qm->sqc) {
195-
memcpy(&sqc, qm->sqc + qp_id * sizeof(struct qm_sqc), sizeof(struct qm_sqc));
195+
memcpy(&sqc, qm->sqc + qp_id, sizeof(struct qm_sqc));
196196
sqc.base_h = cpu_to_le32(QM_XQC_ADDR_MASK);
197197
sqc.base_l = cpu_to_le32(QM_XQC_ADDR_MASK);
198198
dump_show(qm, &sqc, sizeof(struct qm_sqc), "SOFT SQC");
@@ -229,7 +229,7 @@ static int qm_cqc_dump(struct hisi_qm *qm, char *s, char *name)
229229

230230
down_read(&qm->qps_lock);
231231
if (qm->cqc) {
232-
memcpy(&cqc, qm->cqc + qp_id * sizeof(struct qm_cqc), sizeof(struct qm_cqc));
232+
memcpy(&cqc, qm->cqc + qp_id, sizeof(struct qm_cqc));
233233
cqc.base_h = cpu_to_le32(QM_XQC_ADDR_MASK);
234234
cqc.base_l = cpu_to_le32(QM_XQC_ADDR_MASK);
235235
dump_show(qm, &cqc, sizeof(struct qm_cqc), "SOFT CQC");

0 commit comments

Comments
 (0)