Re: [PATCH v2] rcu: Fix buffer overlow in print_cpu_stall_info()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon,  1 Apr 2024 21:54:54 +0300
Nikita Kiryushin <kiryushin@xxxxxxxx> wrote:

> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -504,7 +504,8 @@ static void print_cpu_stall_info(int cpu)
>  			rcu_dynticks_in_eqs(rcu_dynticks_snap(cpu));
>  	rcuc_starved = rcu_is_rcuc_kthread_starving(rdp, &j);
>  	if (rcuc_starved)
> -		sprintf(buf, " rcuc=%ld jiffies(starved)", j);
> +		/* %ld is intentional, for easier bug detection */

The above still has assumptions of what is going on for the reviewer.
I would suggest something a bit more obvious like:

		/* Print signed value, as negative means it is likely a bug */


> +		snprintf(buf, sizeof(buf), " rcuc=%ld jiffies(starved)", j);
>  	pr_err("\t%d-%c%c%c%c: (%lu %s) idle=%04x/%ld/%#lx softirq=%u/%u fqs=%ld%s%s\n",

-- Steve




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux