Skip to content

Commit 5b4049d

Browse files
committed
Merge tag 'writeback_for_v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull writeback fix from Jan Kara: "A fix of possible missing string termination in writeback tracepoints" * tag 'writeback_for_v5.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: trace: fix potenial dangerous pointer
2 parents 85a2c56 + fdeb17c commit 5b4049d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/trace/events/writeback.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ TRACE_EVENT(inode_foreign_history,
190190
),
191191

192192
TP_fast_assign(
193-
strncpy(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32);
193+
strscpy_pad(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32);
194194
__entry->ino = inode->i_ino;
195195
__entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc);
196196
__entry->history = history;
@@ -219,7 +219,7 @@ TRACE_EVENT(inode_switch_wbs,
219219
),
220220

221221
TP_fast_assign(
222-
strncpy(__entry->name, bdi_dev_name(old_wb->bdi), 32);
222+
strscpy_pad(__entry->name, bdi_dev_name(old_wb->bdi), 32);
223223
__entry->ino = inode->i_ino;
224224
__entry->old_cgroup_ino = __trace_wb_assign_cgroup(old_wb);
225225
__entry->new_cgroup_ino = __trace_wb_assign_cgroup(new_wb);
@@ -252,7 +252,7 @@ TRACE_EVENT(track_foreign_dirty,
252252
struct address_space *mapping = page_mapping(page);
253253
struct inode *inode = mapping ? mapping->host : NULL;
254254

255-
strncpy(__entry->name, bdi_dev_name(wb->bdi), 32);
255+
strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32);
256256
__entry->bdi_id = wb->bdi->id;
257257
__entry->ino = inode ? inode->i_ino : 0;
258258
__entry->memcg_id = wb->memcg_css->id;
@@ -285,7 +285,7 @@ TRACE_EVENT(flush_foreign,
285285
),
286286

287287
TP_fast_assign(
288-
strncpy(__entry->name, bdi_dev_name(wb->bdi), 32);
288+
strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32);
289289
__entry->cgroup_ino = __trace_wb_assign_cgroup(wb);
290290
__entry->frn_bdi_id = frn_bdi_id;
291291
__entry->frn_memcg_id = frn_memcg_id;

0 commit comments

Comments
 (0)