* [PATCH v2] kyber: fix wrong strlcpy() size in trace_kyber_latency()
@ 2018-11-12 8:08 Omar Sandoval
2018-11-12 13:52 ` Jordan Glover
2018-11-12 15:29 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Omar Sandoval @ 2018-11-12 8:08 UTC (permalink / raw)
To: linux-block; +Cc: Jens Axboe, kernel-team, Jordan Glover, Bart Van Assche
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"). Fix it by changing all of the strlcpy() calls to use
sizeof().
Fixes: 6c3b7af1c975 ("kyber: add tracepoints")
Reported-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
Changes from v1:
- Change to using sizeof() instead of constants
include/trace/events/kyber.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/kyber.h b/include/trace/events/kyber.h
index a9834c37ac40..c0e7d24ca256 100644
--- a/include/trace/events/kyber.h
+++ b/include/trace/events/kyber.h
@@ -31,8 +31,8 @@ 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->domain, domain, sizeof(__entry->domain));
+ strlcpy(__entry->type, type, sizeof(__entry->type));
__entry->percentile = percentile;
__entry->numerator = numerator;
__entry->denominator = denominator;
@@ -60,7 +60,7 @@ TRACE_EVENT(kyber_adjust,
TP_fast_assign(
__entry->dev = disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
- strlcpy(__entry->domain, domain, DOMAIN_LEN);
+ strlcpy(__entry->domain, domain, sizeof(__entry->domain));
__entry->depth = depth;
),
@@ -82,7 +82,7 @@ TRACE_EVENT(kyber_throttled,
TP_fast_assign(
__entry->dev = disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
- strlcpy(__entry->domain, domain, DOMAIN_LEN);
+ strlcpy(__entry->domain, domain, sizeof(__entry->domain));
),
TP_printk("%d,%d %s", MAJOR(__entry->dev), MINOR(__entry->dev),
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kyber: fix wrong strlcpy() size in trace_kyber_latency()
2018-11-12 8:08 [PATCH v2] kyber: fix wrong strlcpy() size in trace_kyber_latency() Omar Sandoval
@ 2018-11-12 13:52 ` Jordan Glover
2018-11-12 15:29 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jordan Glover @ 2018-11-12 13:52 UTC (permalink / raw)
To: Omar Sandoval; +Cc: linux-block, Jens Axboe, kernel-team, Bart Van Assche
On Monday, November 12, 2018 9:08 AM, Omar Sandoval <osandov@osandov.com> w=
rote:
> 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"). Fix it by changing all of the strlcpy() calls to use
> sizeof().
>
> Fixes: 6c3b7af1c975 ("kyber: add tracepoints")
> Reported-by: Jordan Glover Golden_Miller83@protonmail.ch
> Signed-off-by: Omar Sandoval osandov@fb.com
>
> Changes from v1:
>
> - Change to using sizeof() instead of constants
>
> include/trace/events/kyber.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/trace/events/kyber.h b/include/trace/events/kybe=
r.h
> index a9834c37ac40..c0e7d24ca256 100644
> --- a/include/trace/events/kyber.h
> +++ b/include/trace/events/kyber.h
> @@ -31,8 +31,8 @@ TRACE_EVENT(kyber_latency,
>
> TP_fast_assign(
> __entry->dev =3D 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->domain, domain, sizeof(__entry->domain));
>
>
> - strlcpy(__entry->type, type, sizeof(__entry->type));
>
> __entry->percentile=09=3D percentile;
>
> __entry->numerator=09=3D numerator;
>
> __entry->denominator=09=3D denominator;
>
>
>
> @@ -60,7 +60,7 @@ TRACE_EVENT(kyber_adjust,
>
> TP_fast_assign(
> __entry->dev =3D disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
>
> - strlcpy(__entry->domain, domain, DOMAIN_LEN);
>
>
>
> - strlcpy(__entry->domain, domain, sizeof(__entry->domain));
>
> __entry->depth=09=09=3D depth;
>
>
> ),
>
> @@ -82,7 +82,7 @@ TRACE_EVENT(kyber_throttled,
>
> TP_fast_assign(
> __entry->dev =3D disk_devt(dev_to_disk(kobj_to_dev(q->kobj.parent)));
>
>
> - strlcpy(__entry->domain, domain, DOMAIN_LEN);
>
>
>
> - strlcpy(__entry->domain, domain, sizeof(__entry->domain));
>
>
> ),
>
> TP_printk("%d,%d %s", MAJOR(__entry->dev), MINOR(__entry->dev),
>
>
> --
> 2.19.1
Tested-by: Jordan Glover <Golden_Miller83@protonmail.ch>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kyber: fix wrong strlcpy() size in trace_kyber_latency()
2018-11-12 8:08 [PATCH v2] kyber: fix wrong strlcpy() size in trace_kyber_latency() Omar Sandoval
2018-11-12 13:52 ` Jordan Glover
@ 2018-11-12 15:29 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2018-11-12 15:29 UTC (permalink / raw)
To: Omar Sandoval, linux-block; +Cc: kernel-team, Jordan Glover, Bart Van Assche
On 11/12/18 1:08 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"). Fix it by changing all of the strlcpy() calls to use
> sizeof().
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-12 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 8:08 [PATCH v2] kyber: fix wrong strlcpy() size in trace_kyber_latency() Omar Sandoval
2018-11-12 13:52 ` Jordan Glover
2018-11-12 15:29 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.