Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-6.17-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux

Pull orangefs updates from Mike Marshall:
"Fixes for string handling in debugfs and sysfs:

- change scnprintf to sysfs_emit in sysfs code.

- change sprintf to scnprintf in debugfs code.

- refactor debugfs mask-to-string code for readability and slightly
improved functionality"

* tag 'for-linus-6.17-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
fs/orangefs: Allow 2 more characters in do_c_string()
fs: orangefs: replace scnprintf() with sysfs_emit()
fs/orangefs: use snprintf() instead of sprintf()

+14 -22
+4 -4
fs/orangefs/orangefs-debugfs.c
··· 396 396 goto out; 397 397 398 398 mutex_lock(&orangefs_debug_lock); 399 - sprintf_ret = sprintf(buf, "%s", (char *)file->private_data); 399 + sprintf_ret = scnprintf(buf, ORANGEFS_MAX_DEBUG_STRING_LEN, "%s", (char *)file->private_data); 400 400 mutex_unlock(&orangefs_debug_lock); 401 401 402 402 read_ret = simple_read_from_buffer(ubuf, count, ppos, buf, sprintf_ret); ··· 769 769 770 770 if (*mask & s_kmod_keyword_mask_map[index].mask_val) { 771 771 if ((strlen(kernel_debug_string) + 772 - strlen(s_kmod_keyword_mask_map[index].keyword)) 773 - < ORANGEFS_MAX_DEBUG_STRING_LEN - 1) { 772 + strlen(s_kmod_keyword_mask_map[index].keyword) + 1) 773 + < ORANGEFS_MAX_DEBUG_STRING_LEN) { 774 774 strcat(kernel_debug_string, 775 775 s_kmod_keyword_mask_map[index].keyword); 776 776 strcat(kernel_debug_string, ","); ··· 797 797 (mask->mask2 & cdm_array[index].mask2)) { 798 798 if ((strlen(client_debug_string) + 799 799 strlen(cdm_array[index].keyword) + 1) 800 - < ORANGEFS_MAX_DEBUG_STRING_LEN - 2) { 800 + < ORANGEFS_MAX_DEBUG_STRING_LEN) { 801 801 strcat(client_debug_string, 802 802 cdm_array[index].keyword); 803 803 strcat(client_debug_string, ",");
+10 -18
fs/orangefs/orangefs-sysfs.c
··· 217 217 218 218 if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) { 219 219 if (!strcmp(attr->attr.name, "op_timeout_secs")) { 220 - rc = scnprintf(buf, 221 - PAGE_SIZE, 220 + rc = sysfs_emit(buf, 222 221 "%d\n", 223 222 op_timeout_secs); 224 223 goto out; 225 224 } else if (!strcmp(attr->attr.name, 226 225 "slot_timeout_secs")) { 227 - rc = scnprintf(buf, 228 - PAGE_SIZE, 226 + rc = sysfs_emit(buf, 229 227 "%d\n", 230 228 slot_timeout_secs); 231 229 goto out; 232 230 } else if (!strcmp(attr->attr.name, 233 231 "cache_timeout_msecs")) { 234 - rc = scnprintf(buf, 235 - PAGE_SIZE, 232 + rc = sysfs_emit(buf, 236 233 "%d\n", 237 234 orangefs_cache_timeout_msecs); 238 235 goto out; 239 236 } else if (!strcmp(attr->attr.name, 240 237 "dcache_timeout_msecs")) { 241 - rc = scnprintf(buf, 242 - PAGE_SIZE, 238 + rc = sysfs_emit(buf, 243 239 "%d\n", 244 240 orangefs_dcache_timeout_msecs); 245 241 goto out; 246 242 } else if (!strcmp(attr->attr.name, 247 243 "getattr_timeout_msecs")) { 248 - rc = scnprintf(buf, 249 - PAGE_SIZE, 244 + rc = sysfs_emit(buf, 250 245 "%d\n", 251 246 orangefs_getattr_timeout_msecs); 252 247 goto out; ··· 251 256 252 257 } else if (!strcmp(kobj->name, STATS_KOBJ_ID)) { 253 258 if (!strcmp(attr->attr.name, "reads")) { 254 - rc = scnprintf(buf, 255 - PAGE_SIZE, 259 + rc = sysfs_emit(buf, 256 260 "%lu\n", 257 261 orangefs_stats.reads); 258 262 goto out; 259 263 } else if (!strcmp(attr->attr.name, "writes")) { 260 - rc = scnprintf(buf, 261 - PAGE_SIZE, 264 + rc = sysfs_emit(buf, 262 265 "%lu\n", 263 266 orangefs_stats.writes); 264 267 goto out; ··· 490 497 if (strcmp(kobj->name, PC_KOBJ_ID)) { 491 498 if (new_op->upcall.req.param.op == 492 499 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) { 493 - rc = scnprintf(buf, PAGE_SIZE, "%d %d\n", 500 + rc = sysfs_emit(buf, "%d %d\n", 494 501 (int)new_op->downcall.resp.param.u. 495 502 value32[0], 496 503 (int)new_op->downcall.resp.param.u. 497 504 value32[1]); 498 505 } else { 499 - rc = scnprintf(buf, PAGE_SIZE, "%d\n", 506 + rc = sysfs_emit(buf, "%d\n", 500 507 (int)new_op->downcall.resp.param.u.value64); 501 508 } 502 509 } else { 503 - rc = scnprintf( 510 + rc = sysfs_emit( 504 511 buf, 505 - PAGE_SIZE, 506 512 "%s", 507 513 new_op->downcall.resp.perf_count.buffer); 508 514 }