net: qrtr: Add condition to check data length while logging
For non QMI packets having data length less than eight bytes, skb_copy_bits fails to copy packet data to log buffer. So, Add condition to check data length. If the data length is less than eight bytes, send actual data length to skb_copy_bits. Change-Id: I2181016f224952d214a8f39fb06b47ace01dc51a Signed-off-by: Pranav Mahesh Phansalkar <quic_pphansal@quicinc.com>
This commit is contained in:
parent
d2fad072d1
commit
cc7ea4f701
@ -3,6 +3,7 @@
|
||||
* Copyright (c) 2015, Sony Mobile Communications Inc.
|
||||
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/module.h>
|
||||
@ -246,7 +247,8 @@ static void qrtr_log_tx_msg(struct qrtr_node *node, struct qrtr_hdr_v1 *hdr,
|
||||
|
||||
type = le32_to_cpu(hdr->type);
|
||||
if (type == QRTR_TYPE_DATA) {
|
||||
skb_copy_bits(skb, QRTR_HDR_MAX_SIZE, &pl_buf, sizeof(pl_buf));
|
||||
skb_copy_bits(skb, sizeof(*hdr), &pl_buf, hdr->size > sizeof(pl_buf) ?
|
||||
sizeof(pl_buf) : hdr->size);
|
||||
QRTR_INFO(node->ilc,
|
||||
"TX DATA: Len:0x%x CF:0x%x src[0x%x:0x%x] dst[0x%x:0x%x] [%08x %08x] [%s]\n",
|
||||
hdr->size, hdr->confirm_rx,
|
||||
@ -294,7 +296,8 @@ static void qrtr_log_rx_msg(struct qrtr_node *node, struct sk_buff *skb)
|
||||
cb = (struct qrtr_cb *)skb->cb;
|
||||
|
||||
if (cb->type == QRTR_TYPE_DATA) {
|
||||
skb_copy_bits(skb, 0, &pl_buf, sizeof(pl_buf));
|
||||
skb_copy_bits(skb, 0, &pl_buf, skb->len > sizeof(pl_buf) ?
|
||||
sizeof(pl_buf) : skb->len);
|
||||
QRTR_INFO(node->ilc,
|
||||
"RX DATA: Len:0x%x CF:0x%x src[0x%x:0x%x] dst[0x%x:0x%x] [%08x %08x]\n",
|
||||
skb->len, cb->confirm_rx, cb->src_node, cb->src_port,
|
||||
|
Loading…
Reference in New Issue
Block a user