Loading drivers/char/diag/diag_debugfs.c +128 −139 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. */ #ifdef CONFIG_DEBUG_FS Loading Loading @@ -480,7 +480,6 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, int i = 0; int j = 0; unsigned int buf_size; unsigned int bytes_remaining = 0; unsigned int bytes_written = 0; unsigned int bytes_in_buffer = 0; struct diag_socket_info *info = NULL; Loading @@ -499,8 +498,8 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, } buf_size = ksize(buf); bytes_remaining = buf_size; for (i = 0; i < NUM_TYPES; i++) { i = diag_dbgfs_socketinfo_index; for (j = 0; j < NUM_PERIPHERALS; j++) { switch (i) { case TYPE_DATA: Loading @@ -519,13 +518,13 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, info = &socket_dci_cmd[j]; break; default: kfree(buf); return -EINVAL; } fwd_ctxt = (struct diagfwd_info *)(info->fwd_ctxt); bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining, buf_size, "name\t\t:\t%s\n" "hdl\t\t:\t%pK\n" "inited\t\t:\t%d\n" Loading Loading @@ -561,16 +560,13 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, (fwd_ctxt) ? atomic_read(&fwd_ctxt->opened) : -1, (fwd_ctxt) ? fwd_ctxt->ch_open : -1); bytes_in_buffer += bytes_written; /* Check if there is room to add another table entry */ bytes_remaining = buf_size - bytes_in_buffer; bytes_in_buffer += bytes_written; if (bytes_remaining < bytes_written) break; } } diag_dbgfs_socketinfo_index = i+1; diag_dbgfs_socketinfo_index += 1; *ppos = 0; ret = simple_read_from_buffer(ubuf, count, ppos, buf, bytes_in_buffer); Loading @@ -586,7 +582,6 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, int i = 0; int j = 0; unsigned int buf_size; unsigned int bytes_remaining = 0; unsigned int bytes_written = 0; unsigned int bytes_in_buffer = 0; struct diag_rpmsg_info *info = NULL; Loading @@ -603,8 +598,7 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, return -ENOMEM; buf_size = ksize(buf); bytes_remaining = buf_size; for (i = 0; i < NUM_TYPES; i++) { i = diag_dbgfs_rpmsginfo_index; for (j = 0; j < NUM_PERIPHERALS; j++) { switch (i) { case TYPE_DATA: Loading @@ -623,13 +617,13 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, info = &rpmsg_dci_cmd[j]; break; default: kfree(buf); return -EINVAL; } fwd_ctxt = (struct diagfwd_info *)(info->fwd_ctxt); bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining, buf_size, "name\t\t:\t%s:\t%s\n" "hdl\t\t:\t%pK\n" "inited\t\t:\t%d\n" Loading Loading @@ -664,16 +658,11 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, (fwd_ctxt) ? atomic_read(&fwd_ctxt->opened) : -1, (fwd_ctxt) ? fwd_ctxt->ch_open : -1); bytes_in_buffer += bytes_written; /* Check if there is room to add another table entry */ bytes_remaining = buf_size - bytes_in_buffer; if (bytes_remaining < bytes_written) break; } bytes_in_buffer += bytes_written; } diag_dbgfs_rpmsginfo_index = i+1; diag_dbgfs_rpmsginfo_index += 1; *ppos = 0; ret = simple_read_from_buffer(ubuf, count, ppos, buf, bytes_in_buffer); Loading Loading
drivers/char/diag/diag_debugfs.c +128 −139 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved. */ #ifdef CONFIG_DEBUG_FS Loading Loading @@ -480,7 +480,6 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, int i = 0; int j = 0; unsigned int buf_size; unsigned int bytes_remaining = 0; unsigned int bytes_written = 0; unsigned int bytes_in_buffer = 0; struct diag_socket_info *info = NULL; Loading @@ -499,8 +498,8 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, } buf_size = ksize(buf); bytes_remaining = buf_size; for (i = 0; i < NUM_TYPES; i++) { i = diag_dbgfs_socketinfo_index; for (j = 0; j < NUM_PERIPHERALS; j++) { switch (i) { case TYPE_DATA: Loading @@ -519,13 +518,13 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, info = &socket_dci_cmd[j]; break; default: kfree(buf); return -EINVAL; } fwd_ctxt = (struct diagfwd_info *)(info->fwd_ctxt); bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining, buf_size, "name\t\t:\t%s\n" "hdl\t\t:\t%pK\n" "inited\t\t:\t%d\n" Loading Loading @@ -561,16 +560,13 @@ static ssize_t diag_dbgfs_read_socketinfo(struct file *file, char __user *ubuf, (fwd_ctxt) ? atomic_read(&fwd_ctxt->opened) : -1, (fwd_ctxt) ? fwd_ctxt->ch_open : -1); bytes_in_buffer += bytes_written; /* Check if there is room to add another table entry */ bytes_remaining = buf_size - bytes_in_buffer; bytes_in_buffer += bytes_written; if (bytes_remaining < bytes_written) break; } } diag_dbgfs_socketinfo_index = i+1; diag_dbgfs_socketinfo_index += 1; *ppos = 0; ret = simple_read_from_buffer(ubuf, count, ppos, buf, bytes_in_buffer); Loading @@ -586,7 +582,6 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, int i = 0; int j = 0; unsigned int buf_size; unsigned int bytes_remaining = 0; unsigned int bytes_written = 0; unsigned int bytes_in_buffer = 0; struct diag_rpmsg_info *info = NULL; Loading @@ -603,8 +598,7 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, return -ENOMEM; buf_size = ksize(buf); bytes_remaining = buf_size; for (i = 0; i < NUM_TYPES; i++) { i = diag_dbgfs_rpmsginfo_index; for (j = 0; j < NUM_PERIPHERALS; j++) { switch (i) { case TYPE_DATA: Loading @@ -623,13 +617,13 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, info = &rpmsg_dci_cmd[j]; break; default: kfree(buf); return -EINVAL; } fwd_ctxt = (struct diagfwd_info *)(info->fwd_ctxt); bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining, buf_size, "name\t\t:\t%s:\t%s\n" "hdl\t\t:\t%pK\n" "inited\t\t:\t%d\n" Loading Loading @@ -664,16 +658,11 @@ static ssize_t diag_dbgfs_read_rpmsginfo(struct file *file, char __user *ubuf, (fwd_ctxt) ? atomic_read(&fwd_ctxt->opened) : -1, (fwd_ctxt) ? fwd_ctxt->ch_open : -1); bytes_in_buffer += bytes_written; /* Check if there is room to add another table entry */ bytes_remaining = buf_size - bytes_in_buffer; if (bytes_remaining < bytes_written) break; } bytes_in_buffer += bytes_written; } diag_dbgfs_rpmsginfo_index = i+1; diag_dbgfs_rpmsginfo_index += 1; *ppos = 0; ret = simple_read_from_buffer(ubuf, count, ppos, buf, bytes_in_buffer); Loading