Skip to content

Commit 6908c5f

Browse files
gcabidduherbertx
authored andcommitted
crypto: qat - fix seq_file position update in adf_ring_next()
The `adf_ring_next()` function in the QAT debug transport interface fails to correctly update the position index when reaching the end of the ring elements. This triggers the following kernel warning when reading ring files, such as /sys/kernel/debug/qat_c6xx_<D:B:D:F>/transport/bank_00/ring_00: [27725.022965] seq_file: buggy .next function adf_ring_next [intel_qat] did not update position index Ensure that the `*pos` index is incremented before returning NULL when after the last element in the ring is found, satisfying the seq_file API requirements and preventing the warning. Fixes: a672a9d ("crypto: qat - Intel(R) QAT transport code") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Ahsan Atta <ahsan.atta@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent d41d75f commit 6908c5f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/crypto/intel/qat/qat_common/adf_transport_debug.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ static void *adf_ring_next(struct seq_file *sfile, void *v, loff_t *pos)
3131
struct adf_etr_ring_data *ring = sfile->private;
3232

3333
if (*pos >= (ADF_SIZE_TO_RING_SIZE_IN_BYTES(ring->ring_size) /
34-
ADF_MSG_SIZE_TO_BYTES(ring->msg_size)))
34+
ADF_MSG_SIZE_TO_BYTES(ring->msg_size))) {
35+
(*pos)++;
3536
return NULL;
37+
}
3638

3739
return ring->base_addr +
3840
(ADF_MSG_SIZE_TO_BYTES(ring->msg_size) * (*pos)++);

0 commit comments

Comments
 (0)