public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency()
@ 2018-11-11 17:25 Omar Sandoval
  2018-11-11 18:13 ` Omar Sandoval
  2018-11-11 19:11 ` Bart Van Assche
  0 siblings, 2 replies; 3+ messages in thread
From: Omar Sandoval @ 2018-11-11 17:25 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe, kernel-team, Jordan Glover

From: Omar Sandoval <osandov@fb.com>

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@protonmail.ch>
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 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;
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency()
  2018-11-11 17:25 [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency() Omar Sandoval
@ 2018-11-11 18:13 ` Omar Sandoval
  2018-11-11 19:11 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Omar Sandoval @ 2018-11-11 18:13 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe, kernel-team, Jordan Glover

On Sun, Nov 11, 2018 at 09:25:27AM -0800, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> 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.

Oh, I forgot

Fixes: 6c3b7af1c975 ("kyber: add tracepoints")

> Reported-by: Jordan Glover <Golden_Miller83@protonmail.ch>
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> ---
>  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;
> -- 
> 2.19.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency()
  2018-11-11 17:25 [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency() Omar Sandoval
  2018-11-11 18:13 ` Omar Sandoval
@ 2018-11-11 19:11 ` Bart Van Assche
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2018-11-11 19:11 UTC (permalink / raw)
  To: Omar Sandoval, linux-block; +Cc: Jens Axboe, kernel-team, Jordan Glover

On 11/11/18 9:25 AM, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> 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@protonmail.ch>
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> ---
>   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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-11 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-11 17:25 [PATCH] kyber: fix wrong strlcpy() size in trace_kyber_latency() Omar Sandoval
2018-11-11 18:13 ` Omar Sandoval
2018-11-11 19:11 ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox