Re: [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency()

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

 



On 11/11/18 9:25 AM, Omar Sandoval wrote:
From: Omar Sandoval <osandov@xxxxxx>

When copying to the latency type, we should be passing LATENCY_TYPE_LEN,
not DOMAIN_LEN. This isn't a problem in practice because we only pass
"total" or "I/O", but let's fix it.

Reported-by: Jordan Glover <Golden_Miller83@xxxxxxxxxxxxx>
Signed-off-by: Omar Sandoval <osandov@xxxxxx>
---
  include/trace/events/kyber.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/kyber.h b/include/trace/events/kyber.h
index a9834c37ac40..7aaa298375ad 100644
--- a/include/trace/events/kyber.h
+++ b/include/trace/events/kyber.h
@@ -32,7 +32,7 @@ TRACE_EVENT(kyber_latency,
  	TP_fast_assign(
  		__entry->dev		= disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
  		strlcpy(__entry->domain, domain, DOMAIN_LEN);
-		strlcpy(__entry->type, type, DOMAIN_LEN);
+		strlcpy(__entry->type, type, LATENCY_TYPE_LEN);
  		__entry->percentile	= percentile;
  		__entry->numerator	= numerator;
  		__entry->denominator	= denominator;

Can both strlcpy() invocations be changed such that the third argument is a sizeof() expression instead of an explicit constant? I think that would make the Kyber tracing code easier to verify for humans.

Thanks,

Bart.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux