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 'firewire-fixes-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394

Pull firewire fixes Takashi Sakamoto:
"The previous pull includes some regressions in some device attributes
exposed to sysfs. They are fixed now"

* tag 'firewire-fixes-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: core: add memo about the caller of show functions for device attributes
Revert "firewire: Kill unnecessary buf check in device_attribute.show"

+14 -4
+14 -4
drivers/firewire/core-device.c
··· 322 322 if (value < 0) 323 323 return -ENOENT; 324 324 325 - return sysfs_emit(buf, "0x%06x\n", value); 325 + // Note that this function is also called by init_fw_attribute_group() with NULL pointer. 326 + return buf ? sysfs_emit(buf, "0x%06x\n", value) : 0; 326 327 } 327 328 328 329 #define IMMEDIATE_ATTR(name, key) \ ··· 335 334 struct config_rom_attribute *attr = 336 335 container_of(dattr, struct config_rom_attribute, attr); 337 336 const u32 *directories[] = {NULL, NULL}; 337 + size_t bufsize; 338 + char dummy_buf[2]; 338 339 int i, ret = -ENOENT; 339 340 340 341 down_read(&fw_device_rwsem); ··· 358 355 } 359 356 } 360 357 358 + // Note that this function is also called by init_fw_attribute_group() with NULL pointer. 359 + if (buf) { 360 + bufsize = PAGE_SIZE - 1; 361 + } else { 362 + buf = dummy_buf; 363 + bufsize = 1; 364 + } 365 + 361 366 for (i = 0; i < ARRAY_SIZE(directories) && !!directories[i]; ++i) { 362 - int result = fw_csr_string(directories[i], attr->key, buf, 363 - PAGE_SIZE - 1); 367 + int result = fw_csr_string(directories[i], attr->key, buf, bufsize); 364 368 // Detected. 365 369 if (result >= 0) { 366 370 ret = result; ··· 376 366 // in the root directory follows to the directory entry for vendor ID 377 367 // instead of the immediate value for vendor ID. 378 368 result = fw_csr_string(directories[i], CSR_DIRECTORY | attr->key, buf, 379 - PAGE_SIZE - 1); 369 + bufsize); 380 370 if (result >= 0) 381 371 ret = result; 382 372 }