id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
60439471f30be00dc4f6648322ab1a3a3f89777f
Analyze and fix the following issue in the Linux kernel code: selftests: cgroup: fix test_kmem_basic less than error
Problem Details: test_kmem_basic creates 100,000 negative dentries, with each one mapping to a slab object. After memory.high is set, these are reclaimed through the shrink_slab function call which reclaims all 100,000 entries. The test passes the majority of the time because when slab1 or current is calculated, it i...
```diff diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c index 1b2cec9d18a4..ed2e50bb1e76 100644 --- a/tools/testing/selftests/cgroup/test_kmem.c +++ b/tools/testing/selftests/cgroup/test_kmem.c @@ -75,11 +75,11 @@ static int test_kmem_basic(const char *root) sleep(...
8b9c1cc0418a43196477083e7082568e7a4c9418
Analyze and fix the following issue in the Linux kernel code: smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd()
Problem Details: We shouldn't be using a GUP-internal helper if it can be avoided. Similar to smaps_pte_entry() that uses vm_normal_page(), let's use vm_normal_page_pmd() that similarly refuses to return the huge zeropage. In contrast to follow_trans_huge_pmd(), vm_normal_page_pmd(): (1) Will always return the head ...
```diff diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 507cd4e59d07..fc744964816e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -587,8 +587,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, bool migration = false; if (pmd_present(*pmd)) { - /* FOLL_DUMP will return -EFAUL...
d74943a2f3cdade34e471b36f55f7979be656867
Analyze and fix the following issue in the Linux kernel code: mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT
Problem Details: Unfortunately commit 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()") missed that follow_page() and follow_trans_huge_pmd() never implicitly set FOLL_NUMA because they really don't want to fail on PROT_NONE-mapped pages -- either due to NUMA hinting or due to inaccessible (PROT_N...
```diff diff --git a/include/linux/mm.h b/include/linux/mm.h index 406ab9ea818f..34f9dba17c1a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3421,15 +3421,24 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) * Indicates whether GUP can follow a PROT_NONE mapped page, or whether...
1f0bbf28940cf5edad90ab57b62aa8197bf5e836
Analyze and fix the following issue in the Linux kernel code: nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()
Problem Details: iov_len is the valid data length, so pass iov_len instead of sg->length to bvec_set_page(). Fixes: 5bfaba275ae6 ("nvmet-tcp: don't map pages which can't come from HIGHMEM") Signed-off-by: Rakshana Sridhar <rakshanas@chelsio.com> Signed-off-by: Varun Prakash <varun@chelsio.com> Reviewed-by: Sagi Grimbe...
```diff diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 868aa4de2e4c..cd92d7ddf5ed 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -348,7 +348,7 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) while (length) { u32 iov_len = min_t(u32, length, s...
5c13e2388bf3426fd69a89eb46e50469e9624e56
Analyze and fix the following issue in the Linux kernel code: f2fs: avoid false alarm of circular locking
Problem Details: ====================================================== WARNING: possible circular locking dependency detected 6.5.0-rc5-syzkaller-00353-gae545c3283dc #0 Not tainted ------------------------------------------------------ syz-executor273/5027 is trying to acquire lock: ffff888077fe1fb0 (&fi->i_sem){+.+.}...
```diff diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index c602ff2403b6..c0b7417f1d87 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2122,15 +2122,6 @@ static inline int f2fs_down_read_trylock(struct f2fs_rwsem *sem) return down_read_trylock(&sem->internal_rwsem); } -#ifdef CONFIG_DEBUG_LOCK_ALLOC -static in...
da54556695b9ab20cc696827247ffff02254b78d
Analyze and fix the following issue in the Linux kernel code: net/mlx5: Convert PCI error values to generic errnos
Problem Details: mlx5_pci_link_toggle() returns a mix of PCI-specific error codes and generic errnos. Convert the PCI-specific error values to generic errno using pcibios_err_to_errno() before returning them. Fixes: eabe8e5e88f5 ("net/mlx5: Handle sync reset now event") Fixes: 212b4d7251c1 ("net/mlx5: Wait for firmwa...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c index 99dcbd006357..85a2dfbb5c46 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -311,7 +311,7 @@ static int mlx5_check...
f139492a09f15254fa261245cdbd65555cdf39e3
Analyze and fix the following issue in the Linux kernel code: wifi: ath10k: Use RMW accessors for changing LNKCTL
Problem Details: Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which does proper locking to avoid losing concurrent updates to the register value. On restore, clear the ASPMC field properly. Sugges...
```diff diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index a7f44f6335fb..9275a672f90c 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1963,8 +1963,9 @@ static int ath10k_pci_hif_start(struct ath10k *ar) ath10k_pci_irq_ena...
f5a7ac118faf6d4f794975947b3300717eae8fc5
Analyze and fix the following issue in the Linux kernel code: wifi: ath12k: Use RMW accessors for changing LNKCTL
Problem Details: Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value. On restore, clear the ASPMC field properly. Suggeste...
```diff diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 5990a55801f0..e4f08a066ca1 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -794,8 +794,8 @@ static void ath12k_pci_aspm_disable(struct ath12k_pci *ab_pci) u16_...
6c1b6bdb34aaf8f94f65a9cae1d63490320c11bc
Analyze and fix the following issue in the Linux kernel code: wifi: ath11k: Use RMW accessors for changing LNKCTL
Problem Details: Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value. On restore, clear the ASPMC field properly. Suggeste...
```diff diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 79e2cbe82638..ec40adc1cb23 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -581,8 +581,8 @@ static void ath11k_pci_aspm_disable(struct ath11k_pci *ab_pci) u16_...
30de872537bda526664d7a20b646adfb3e7ce6e6
Analyze and fix the following issue in the Linux kernel code: net/mlx5: Use RMW accessors for changing LNKCTL
Problem Details: Don't assume that only the driver would be accessing LNKCTL of the upstream bridge. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value. Suggested-by: Lukas Wunner <l...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c index 4804990b7f22..99dcbd006357 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -384,16 +384,11 @@ static int mlx5_pci...
7189576e8a829130192b33c5b64e8a475369c776
Analyze and fix the following issue in the Linux kernel code: drm/radeon: Use RMW accessors for changing LNKCTL
Problem Details: Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. And in the case of upstream bridge, the driver does not even own the device it's changing the registers for. Use RMW capability accessors which do proper locking t...
```diff diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 5819737c21c6..a6f3c811ceb8 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -9534,17 +9534,8 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev) u16 bridge_cfg2, gpu_cfg2; u32 max_lw...
d51847acb018d83186e4af67bc93f9a00a8644f7
Analyze and fix the following issue in the Linux kernel code: cpufreq: intel_pstate: set stale CPU frequency to minimum
Problem Details: The intel_pstate CPU frequency scaling driver does not use policy->cur and it is 0. When the CPU frequency is outdated arch_freq_get_on_cpu() will default to the nominal clock frequency when its call to cpufreq_quick_getpolicy_cur returns the never updated 0. Thus, the listed frequency might be outside...
```diff diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 8ca2bce4341a..dc50c9fb488d 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2609,6 +2609,11 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) intel_pstate_clear_update_ut...
7eb6deb3f55678216a6a0e956846c04958093ea5
Analyze and fix the following issue in the Linux kernel code: Revert "pds_core: Fix some kernel-doc comments"
Problem Details: This reverts commit cb39c35783f26892bb1a72b1115c94fa2e77f4c5. Patch was applied to hastily, the problem is already fixed in Alex's vfio tree: https://lore.kernel.org/all/20230821112237.105872b5.alex.williamson@redhat.com/ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
```diff diff --git a/drivers/net/ethernet/amd/pds_core/auxbus.c b/drivers/net/ethernet/amd/pds_core/auxbus.c index f46efebaaea9..6787a5fae908 100644 --- a/drivers/net/ethernet/amd/pds_core/auxbus.c +++ b/drivers/net/ethernet/amd/pds_core/auxbus.c @@ -8,7 +8,7 @@ /** * pds_client_register - Link the client to the f...
ce7d88110b9ed5f33fe79ea6d4ed049fb0e57bce
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Use RMW accessors for changing LNKCTL
Problem Details: Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. And in the case of upstream bridge, the driver does not even own the device it's changing the registers for. Use RMW capability accessors which do proper locking t...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index 5641cf05d856..e63abdf52b6c 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c @@ -1574,17 +1574,8 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev) u16 bridge_cfg2, gpu_cfg2...
ed9571647eff3dd7a53068f83338530959c7ace4
Analyze and fix the following issue in the Linux kernel code: cpufreq: stats: Improve the performance of cpufreq_stats_create_table()
Problem Details: In the worst case, the freq_table of policy data is not sorted and contains duplicate frequencies, this means that it needs to iterate through the entire freq_table of policy to ensure each frequency is unique in the freq_table of stats data, this has a time complexity of O(N^2), where N is the number ...
```diff diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 55c7ffd37d1c..a33df3c66c88 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -243,7 +243,8 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy) /* Find valid-unique entries *...
2ddd3cac1fa988323684cee567356e970e6750bd
Analyze and fix the following issue in the Linux kernel code: nsproxy: Convert nsproxy.count to refcount_t
Problem Details: atomic_t variables are currently used to implement reference counters with the following properties: - counter is initialized to 1 using atomic_set() - a resource is freed upon counter reaching zero - once counter reaches zero, its further increments aren't allowed - counter schema uses basic at...
```diff diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index fee881cded01..771cb0285872 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h @@ -29,7 +29,7 @@ struct fs_struct; * nsproxy is copied. */ struct nsproxy { - atomic_t count; + refcount_t count; struct uts_namespace *uts_n...
9cc8cd086f05d9a01026c65c98da88561e9c619e
Analyze and fix the following issue in the Linux kernel code: ACPI: x86: s2idle: Fix a logic error parsing AMD constraints table
Problem Details: The constraints table should be resetting the `list` object after running through all of `info_obj` iterations. This adjusts whitespace as well as less code will now be included with each loop. This fixes a functional problem is fixed where a badly formed package in the inner loop may have incorrect d...
```diff diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c index 508decbac298..60835953ebfc 100644 --- a/drivers/acpi/x86/s2idle.c +++ b/drivers/acpi/x86/s2idle.c @@ -135,12 +135,11 @@ static void lpi_device_get_constraints_amd(void) struct lpi_constraints *list; acpi_status status; + lis...
7d7c6e8c5fe4e8cceea7f66e93cee1c951670836
Analyze and fix the following issue in the Linux kernel code: net/mlx5: Devcom, only use devcom after NULL check in mlx5_devcom_send_event()
Problem Details: There is a warning reported by kernel test robot: smatch warnings: drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c:264 mlx5_devcom_send_event() warn: variable dereferenced before IS_ERR check devcom (see line 259) The reason for the warning is that the pointer is used before check, put the as...
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c index feb62d952643..00e67910e3ee 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c @@ -256,14 +256,15 @@ int mlx5_de...
f83e2d8aef4acc044465ad6464f54b6a704ec34b
Analyze and fix the following issue in the Linux kernel code: net/mlx5: DR, Fix code indentation
Problem Details: Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c index feb307fb3440..14f6df88b1f9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c @@ -336,7 +336,7 ...
d7cea02a1fac70808423b6c7a64464ba3185f7a9
Analyze and fix the following issue in the Linux kernel code: net/mlx5e: Fix spelling mistake "Faided" -> "Failed"
Problem Details: There is a spelling mistake in a warning message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
```diff diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c index 455746952260..095f31f380fa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c @@ -316,7 +316,7 @@ void ...
df1ae36a4a0e92340daea12e88d43eeb2eb013b1
Analyze and fix the following issue in the Linux kernel code: ext2: Fix kernel-doc warnings
Problem Details: Document a few parameters of ext2_alloc_blocks(). Redo the alloc_new_reservation() and find_next_reservable_window() kernel-doc entirely. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230818201121.2720451-1-willy@infradead.org>
```diff diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 2f48d25170f7..27377a0faa6f 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c @@ -718,36 +718,34 @@ fail_access: } /** - * find_next_reservable_window(): - * find a reservable space within the given range. - * It does not allocate the reservation w...
2e99b73afde18853754c5fae8e8d1a66fe5e3f64
Analyze and fix the following issue in the Linux kernel code: irqchip/loongson-eiointc: Fix return value checking of eiointc_index
Problem Details: Return value of function eiointc_index is int, however it is converted into uint32_t and then compared smaller than zero, this will cause logic problem. Fixes: dd281e1a1a93 ("irqchip: Add Loongson Extended I/O interrupt controller support") Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Ph...
```diff diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c index 92d8aa28bdf5..1623cd779175 100644 --- a/drivers/irqchip/irq-loongson-eiointc.c +++ b/drivers/irqchip/irq-loongson-eiointc.c @@ -144,7 +144,7 @@ static int eiointc_router_init(unsigned int cpu) int i, bit; uint...
67f6317dfa609846a227a706532439a22828c24b
Analyze and fix the following issue in the Linux kernel code: ice: Fix NULL pointer deref during VF reset
Problem Details: During stress test with attaching and detaching VF from KVM and simultaneously changing VFs spoofcheck and trust there was a NULL pointer dereference in ice_reset_vf that VF's VSI is null. More than one instance of ice_reset_vf() can be running at a given time. When we rebuild the VSI in ice_reset_vf,...
```diff diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c index 294e91c3453c..ea3310be8354 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -612,11 +612,17 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) ...
0ecff05e6c59dd82dbcb9706db911f7fd9f40fb8
Analyze and fix the following issue in the Linux kernel code: Revert "ice: Fix ice VF reset during iavf initialization"
Problem Details: This reverts commit 7255355a0636b4eff08d5e8139c77d98f151c4fc. After this commit we are not able to attach VF to VM: virsh attach-interface v0 hostdev --managed 0000:41:01.0 --mac 52:52:52:52:52:52 error: Failed to attach interface error: Cannot set interface MAC to 52:52:52:52:52:52 for ifname enp65s0...
```diff diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c index 1f66914c7a20..31314e7540f8 100644 --- a/drivers/net/ethernet/intel/ice/ice_sriov.c +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c @@ -1131,7 +1131,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, ...
8e6657159131f90b746572f6a5bd622b3ccac82d
Analyze and fix the following issue in the Linux kernel code: ASoC: rt5640: fix typos
Problem Details: I noticed typos and i fixed them. Signed-off-by: Senhong Liu <liusenhong2022@email.szu.edu.cn> Link: https://lore.kernel.org/r/20230819133345.39961-1-liusenhong2022@email.szu.edu.cn Signed-off-by: Mark Brown <broonie@kernel.org>
```diff diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 8920726c38e8..15e1a62b9e57 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2570,7 +2570,7 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FAL...
10083aef784031fa9f06c19a1b182e6fad5338d9
Analyze and fix the following issue in the Linux kernel code: ice: fix receive buffer size miscalculation
Problem Details: The driver is misconfiguring the hardware for some values of MTU such that it could use multiple descriptors to receive a packet when it could have simply used one. Change the driver to use a round-up instead of the result of a shift, as the shift can truncate the lower bits of the size, and result in...
```diff diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c index b678bdf96f3a..074bf9403cd1 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.c +++ b/drivers/net/ethernet/intel/ice/ice_base.c @@ -435,7 +435,8 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring) /...
e2a61151ff8c38ae7b3afae0e91cb97fb211a6bf
Analyze and fix the following issue in the Linux kernel code: wifi: rtw89: fix a width vs precision bug
Problem Details: The "buf" is skb->data that comes from the firmware. We want to print "len" number of bytes. But there is a missing period so the "len" variable is used for formatting (width) instead of limiting the output (precision). Fixes: cad2bd8a136c ("wifi: rtw89: support firmware log with formatted text") Si...
```diff diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 2811a94b5f69..bcd9050f989f 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -1165,7 +1165,7 @@ void rtw89_fw_log_dump(struct rtw89_dev *rtwdev, u8 *buf, u32 l...
b3bfc4fb1edc8136396ece2d7204c2ee5cae188d
Analyze and fix the following issue in the Linux kernel code: wifi: rtw89: 8852b: rfk: fine tune IQK parameters to improve performance on 2GHz band
Problem Details: A few samples get bad performance on 2GHz band, so use proper IQK command code and select another group to have wider range of calibration value. Fixes: f2abe804e823 ("wifi: rtw89: 8852b: rfk: add IQK") Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link:...
```diff diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c index fa018e1f499b..259df67836a0 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c @@ -846,7 +846,7 @@ static bool _iqk_one_shot...
2c18a63b760a0f68f14cb8bb4c3840bb0b63b73e
Analyze and fix the following issue in the Linux kernel code: super: wait until we passed kill super
Problem Details: Recent rework moved block device closing out of sb->put_super() and into sb->kill_sb() to avoid deadlocks as s_umount is held in put_super() and blkdev_put() can end up taking s_umount again. That means we need to move the removal of the superblock from @fs_supers out of generic_shutdown_super() and i...
```diff diff --git a/fs/super.c b/fs/super.c index e2630fe4928a..2f604a6494fb 100644 --- a/fs/super.c +++ b/fs/super.c @@ -153,7 +153,7 @@ static inline bool super_lock_excl(struct super_block *sb) } /* wake waiters */ -#define SUPER_WAKE_FLAGS (SB_BORN | SB_DYING) +#define SUPER_WAKE_FLAGS (SB_BORN | SB_DYING | SB...
5e87491415217d6bec0bcae08a3156622be2b177
Analyze and fix the following issue in the Linux kernel code: super: wait for nascent superblocks
Problem Details: Recent patches experiment with making it possible to allocate a new superblock before opening the relevant block device. Naturally this has intricate side-effects that we get to learn about while developing this. Superblock allocators such as sget{_fc}() return with s_umount of the new superblock held...
```diff diff --git a/fs/super.c b/fs/super.c index ba5d813c5804..e2630fe4928a 100644 --- a/fs/super.c +++ b/fs/super.c @@ -50,7 +50,7 @@ static char *sb_writers_name[SB_FREEZE_LEVELS] = { "sb_internal", }; -static inline void super_lock(struct super_block *sb, bool excl) +static inline void __super_lock(struct sup...
ab55a976095e0c5396ca21a81cab95a7d2a42eee
Analyze and fix the following issue in the Linux kernel code: wifi: mwifiex: fix comment typos in SDIO module
Problem Details: Fix comment typos around ' mwifiex_deaggr_sdio_pkt()' and 'mwifiex_host_to_card_mp_aggr()'. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230814142101.60308-2-dmantipov@yandex.ru
```diff diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 0d60484cd5df..774858cfe86f 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -1556,7 +1556,7 @@ done: } /* - * This function decode sdio ag...
2785851c627f2db05f9271f7f63661b5dbd95c4c
Analyze and fix the following issue in the Linux kernel code: wifi: mwifiex: Fix missed return in oob checks failed path
Problem Details: Add missed return in mwifiex_uap_queue_bridged_pkt() and mwifiex_process_rx_packet(). Fixes: 119585281617 ("wifi: mwifiex: Fix OOB and integer underflow when rx packets") Signed-off-by: Polaris Pi <pinkperfect2021@gmail.com> Reported-by: Dmitry Antipov <dmantipov@yandex.ru> Acked-by: Brian Norris <bri...
```diff diff --git a/drivers/net/wireless/marvell/mwifiex/sta_rx.c b/drivers/net/wireless/marvell/mwifiex/sta_rx.c index f2899d53a43f..65420ad67416 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_rx.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_rx.c @@ -92,6 +92,7 @@ int mwifiex_process_rx_packet(struct mwifie...
9c8fd72a5c2a031cbc680a2990107ecd958ffcdb
Analyze and fix the following issue in the Linux kernel code: wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
Problem Details: Always free the zeroed page on return from 'mwifiex_histogram_read()'. Fixes: cbf6e05527a7 ("mwifiex: add rx histogram statistics support") Acked-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://...
```diff diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c index 52b18f4a774b..0cdd6c50c1c0 100644 --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c @@ -253,8 +253,11 @@ mwifiex_histogram_read(struct file *...
09902f3a1f83085006742f18388b5098c1b57132
Analyze and fix the following issue in the Linux kernel code: doc: dma-buf: Rewrite intro section a little
Problem Details: Make it a little bit more clear what's going on and fix some formatting. Signed-off-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Simon Ser <contact@emersion.fr> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop....
```diff diff --git a/Documentation/driver-api/dma-buf.rst b/Documentation/driver-api/dma-buf.rst index f92a32d095d9..862dbc2759d0 100644 --- a/Documentation/driver-api/dma-buf.rst +++ b/Documentation/driver-api/dma-buf.rst @@ -5,14 +5,22 @@ The dma-buf subsystem provides the framework for sharing buffers for hardware ...
2d12d18f14d9e6e2dcbc3e5942d718e6d4e028a5
Analyze and fix the following issue in the Linux kernel code: vfio/pds: fix return value in pds_vfio_get_lm_file()
Problem Details: anon_inode_getfile() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR(). Fixes: bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Brett Creeley <brett.creeley@amd.com> Lin...
```diff diff --git a/drivers/vfio/pci/pds/lm.c b/drivers/vfio/pci/pds/lm.c index aec75574cab3..79fe2e66bb49 100644 --- a/drivers/vfio/pci/pds/lm.c +++ b/drivers/vfio/pci/pds/lm.c @@ -31,7 +31,7 @@ pds_vfio_get_lm_file(const struct file_operations *fops, int flags, u64 size) /* Create file */ lm_file->filep = ano...
f19df6e4de64b7fc6d71f192aa9ff3b701e4bade
Analyze and fix the following issue in the Linux kernel code: drm/panfrost: Skip speed binning on EOPNOTSUPP
Problem Details: Encountered on an ARM Mali-T760 MP4, attempting to read the nvmem variable can also return EOPNOTSUPP instead of ENOENT when speed binning is unsupported. Cc: <stable@vger.kernel.org> Fixes: 7d690f936e9b ("drm/panfrost: Add basic support for speed binning") Signed-off-by: David Michael <fedora.dm0@gma...
```diff diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 58dfb15a8757..e78de99e9933 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -96,7 +96,7 @@ static int panfrost_read_speedbin(struct device *de...
914d9d831e6126a6e7a92e27fcfaa250671be42c
Analyze and fix the following issue in the Linux kernel code: of: dynamic: Refactor action prints to not use "%pOF" inside devtree_lock
Problem Details: While originally it was fine to format strings using "%pOF" while holding devtree_lock, this now causes a deadlock. Lockdep reports: of_get_parent from of_fwnode_get_parent+0x18/0x24 ^^^^^^^^^^^^^ of_fwnode_get_parent from fwnode_count_parents+0xc/0x28 fwnode_count_parents from fwnode...
```diff diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index e311d406b170..4999636eaa92 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -63,15 +63,14 @@ int of_reconfig_notifier_unregister(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(of_reconfig_notifier_unregister); -#ifdef DEBUG -const...
0aeae3788e28f64ccb95405d4dc8cd80637ffaea
Analyze and fix the following issue in the Linux kernel code: of: unittest: Fix EXPECT for parse_phandle_with_args_map() test
Problem Details: Commit 12e17243d8a1 ("of: base: improve error msg in of_phandle_iterator_next()") added printing of the phandle value on error, but failed to update the unittest. Fixes: 12e17243d8a1 ("of: base: improve error msg in of_phandle_iterator_next()") Cc: stable@vger.kernel.org Reviewed-by: Geert Uytterhoeve...
```diff diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index a406a12eb208..b545fcb22536 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -664,12 +664,12 @@ static void __init of_unittest_parse_phandle_with_args_map(void) memset(&args, 0, sizeof(args)); EXPECT_BEGIN(KERN_INFO, - ...
17a1eab7b70d85fc5711f37bb6e530b771736bb7
Analyze and fix the following issue in the Linux kernel code: ALSA: hda/tas2781: Fix PM refcount unbalance at tas2781_hda_bind()
Problem Details: The error path of tas2781_hda_bind() needs to release PM refcount as well. Modify the code flow to handle properly. Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver") Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Closes: https://lore.kernel.org/r/9f910785-e85...
```diff diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index 0968ae915fd0..aa9ce3837336 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -608,15 +608,13 @@ static int tas2781_hda_bind(struct device *dev, struct device *master, strscpy(comps->name, d...
1c80cc055b3f9fb72606d58c27eb2486c4b919a7
Analyze and fix the following issue in the Linux kernel code: ALSA: hda/tas2781: Fix acpi device refcount leak at tas2781_read_acpi()
Problem Details: The error path at tas2781_read_acpi() doesn't release the acpi_device adev but releases another device physdev instead. This results in a refcount leak. Fix it by replacing with the right object. Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver") Reported-by: Pierre-Louis Bossart <pie...
```diff diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index 35dafc4aec4f..0968ae915fd0 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -118,7 +118,7 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) err: dev_err(p->dev,...
5fadc941d07530d681f3b7ec91e56d8445bc3825
Analyze and fix the following issue in the Linux kernel code: ALSA: usb-audio: Fix init call orders for UAC1
Problem Details: There have been reports of USB-audio driver spewing errors at the probe time on a few devices like Jabra and Logitech. The suggested fix there couldn't be applied as is, unfortunately, because it'll likely break other devices. But, the patch suggested an interesting point: looking at the current init...
```diff diff --git a/sound/usb/stream.c b/sound/usb/stream.c index f10f4e6d3fb8..3d4add94e367 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -1093,6 +1093,7 @@ static int __snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int i, altno, err, stream; struct audioformat *fp = NULL; struct snd_u...
f6834c8c59a8e977a6f6e4f96c5d28dfa5db8430
Analyze and fix the following issue in the Linux kernel code: powerpc/ftrace: Fix dropping weak symbols with older toolchains
Problem Details: The minimum level of gcc supported for building the kernel is v5.1. v5.x releases of gcc emitted a three instruction sequence for -mprofile-kernel: mflr r0 std r0, 16(r1) bl _mcount It is only with the v6.x releases that gcc started emitting the two instruction sequence for -mprofile-kernel, omitti...
```diff diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h index 91c049d51d0e..2edc6269b1a3 100644 --- a/arch/powerpc/include/asm/ftrace.h +++ b/arch/powerpc/include/asm/ftrace.h @@ -12,7 +12,7 @@ /* Ignore unused weak functions which will have larger offsets */ #ifdef CONFIG_MPROFIL...
25e324bc9cf2ee956eec1db384c39c1a17b7c44a
Analyze and fix the following issue in the Linux kernel code: kunit: fix struct kunit_attr header
Problem Details: Add parameter descriptions to struct kunit_attr header for the parameters attr_default and print. Fixes: 39e92cb1e4a1 ("kunit: Add test attributes API structure") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202308180127.VD7YRPGa-lkp@intel.com/ Signed-...
```diff diff --git a/lib/kunit/attributes.c b/lib/kunit/attributes.c index 5e3034b6be99..1b512f7e1838 100644 --- a/lib/kunit/attributes.c +++ b/lib/kunit/attributes.c @@ -30,6 +30,8 @@ enum print_ops { * attribute value * @filter: function to indicate whether a given attribute value passes a * filter + * @attr_de...
187b4c0d34e34cc4a275fd98393a3bc21a460a66
Analyze and fix the following issue in the Linux kernel code: xen: Fix one kernel-doc comment
Problem Details: Use colon to separate parameter name from their specific meaning. silence the warning: drivers/xen/grant-table.c:1051: warning: Function parameter or member 'nr_pages' not described in 'gnttab_free_pages' Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_b...
```diff diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index f13c3b76ad1e..35659bf70746 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -1044,7 +1044,7 @@ EXPORT_SYMBOL_GPL(gnttab_pages_clear_private); /** * gnttab_free_pages - free pages allocated by gnttab_alloc_page...
58a8d2edd57b35307d81ec6c304697707e6067c1
Analyze and fix the following issue in the Linux kernel code: perf stat-display: Check if snprintf()'s fmt argument is NULL
Problem Details: It is undefined behavior to pass NULL as snprintf()'s fmt argument. Here is an example to trigger the problem: $ perf stat --metric-only -x, -e instructions -- sleep 1 insn per cycle, Segmentation fault (core dumped) With this patch: $ perf stat --metric-only -x, -e instructions -- sleep 1 ...
```diff diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index d45d5dcb0e2b..afe6db8e7bf4 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -578,7 +578,7 @@ static void print_metric_only_csv(struct perf_stat_config *config __maybe_unused if (!valid_only_me...
fa69653f87ee3d64cfbe0c1b8190214d71745edc
Analyze and fix the following issue in the Linux kernel code: platform/x86: asus-wmi: Fix support for showing middle fan RPM
Problem Details: After the addition of the mid fan custom curve functionality various incorrect behaviour was uncovered. This commit fixes these areas. - Ensure mid fan attributes actually use the correct fan ID - Correction to a bit mask for selecting the correct fan data - Refactor the curve show/store functions to ...
```diff diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 9805072efd5a..e861e569e37e 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -2900,9 +2900,8 @@ static int fan_curve_get_factory_default(struct asus_wmi *asus, u32 fan_dev) { struct fan_cu...
8cae66574398326134a41513b419e00ad4e380ca
Analyze and fix the following issue in the Linux kernel code: dmaengine: idxd: Fix issues with PRS disable sysfs knob
Problem Details: There are two issues in the current PRS disable sysfs store function wq_prs_disable_store(): 1. Since PRS disable knob is invisible if PRS disable is not supported in WQ, it's redundant to check PRS support again in the store function again. Remove the redundant PRS support check. 2. Since PRS d...
```diff diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index 66c89b07b3f7..a5c3eb434832 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -1131,8 +1131,8 @@ static ssize_t wq_prs_disable_store(struct device *dev, struct device_attribute if (wq->state != IDXD_WQ_DISABLED) ret...
0056a7f07b0a63e6cee815a789eabba6f3a710f0
Analyze and fix the following issue in the Linux kernel code: dmaengine: idxd: Allow ATS disable update only for configurable devices
Problem Details: ATS disable status in a WQ is read-only if the device is not configurable. This change ensures that the ATS disable attribute can be modified via sysfs only on configurable devices. Fixes: 92de5fa2dc39 ("dmaengine: idxd: add ATS disable knob for work queues") Signed-off-by: Fenghua Yu <fenghua.yu@inte...
```diff diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index d16c16445c4f..66c89b07b3f7 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -1088,12 +1088,16 @@ static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute const char *buf, size_t count) ...
33a0b734543ed5a44135e15f00429b94f75f2866
Analyze and fix the following issue in the Linux kernel code: dmaengine: fsl-edma: use struct_size() helper
Problem Details: Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worst scenario, could lead to heap overflows. Signed-off-by: Yu Liao <liaoyu15@huawei.com> Link: https://lore.kernel.org/r/20230821073600.4078584-1-lia...
```diff diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c index e40769666e39..8c9ee9fc7240 100644 --- a/drivers/dma/fsl-edma.c +++ b/drivers/dma/fsl-edma.c @@ -270,9 +270,8 @@ static int fsl_edma_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct fsl_edma_engine *fsl_e...
e7593bda6a2e2e46521567f0ddea940f4acda0db
Analyze and fix the following issue in the Linux kernel code: hwmon: pmbus: Fix -EIO seen on pli1209
Problem Details: After doing performance optimizations the pli1209 driver failed to probe with a probabilty of 2%. It wasn't able to read the PMBUS_OPERATION register due to an -EIO error. An investigation showed that the PLI1209 takes 230 usec to execute the CLEAR_FAULTS command. During that time it's busy and NACKs ...
```diff diff --git a/drivers/hwmon/pmbus/pli1209bc.c b/drivers/hwmon/pmbus/pli1209bc.c index 7d8bd3167b21..c95433790b11 100644 --- a/drivers/hwmon/pmbus/pli1209bc.c +++ b/drivers/hwmon/pmbus/pli1209bc.c @@ -5,6 +5,7 @@ * Copyright (c) 2022 9elements GmbH */ +#include <linux/delay.h> #include <linux/i2c.h> #incl...
1030892c4427e503b32ec46f88179e9138cdbf4e
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/ucd9200) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ucd9200.c:106:10: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel....
```diff diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c index e4aad64b2d94..7920d1c06df0 100644 --- a/drivers/hwmon/pmbus/ucd9200.c +++ b/drivers/hwmon/pmbus/ucd9200.c @@ -103,7 +103,7 @@ static int ucd9200_probe(struct i2c_client *client) } if (client->dev.of_node) - chip = (enum chip...
d29b763c0a047c8b31d0e63575b2a2c4c498214a
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/ucd9000) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ucd9000.c:591:10: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel....
```diff diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index b1d1d4214e69..8d9d422450e5 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c @@ -588,7 +588,7 @@ static int ucd9000_probe(struct i2c_client *client) } if (client->dev.of_node) - chip = (enum chip...
30572c7b086745c3411c1a580319a99eda7a7a56
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/tps53679) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip_id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: tps53679.c:238:13: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.ker...
```diff diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c index e77b12f342b4..5c9466244d70 100644 --- a/drivers/hwmon/pmbus/tps53679.c +++ b/drivers/hwmon/pmbus/tps53679.c @@ -235,7 +235,7 @@ static int tps53679_probe(struct i2c_client *client) enum chips chip_id; if (dev->of_node) - c...
45f980cae3224022f9a1827d57b6732302c0734a
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/ibm-cffps) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'vs' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ibm-cffps.c:492:8: error: cast to smaller integer type 'enum versions' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kerne...
```diff diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c index 5b11aacda4d2..1ba4c5e95820 100644 --- a/drivers/hwmon/pmbus/ibm-cffps.c +++ b/drivers/hwmon/pmbus/ibm-cffps.c @@ -489,7 +489,7 @@ static int ibm_cffps_probe(struct i2c_client *client) const struct i2c_device_id *id; if (m...
58aec51df895c456b6057531e9ee959131b7efda
Analyze and fix the following issue in the Linux kernel code: hwmon: (tmp513) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: tmp513.c:724:14: error: cast to smaller integer type 'enum tmp51x_ids' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kerne...
```diff diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c index bff10f4b56e1..7db5d0fc24a4 100644 --- a/drivers/hwmon/tmp513.c +++ b/drivers/hwmon/tmp513.c @@ -721,7 +721,7 @@ static int tmp51x_probe(struct i2c_client *client) return -ENOMEM; if (client->dev.of_node) - data->id = (enum tmp51x_ids)dev...
d6f09471b331e1f8bf5eb8f1ecde4f62ddee8352
Analyze and fix the following issue in the Linux kernel code: hwmon: (max6697) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: max6697.c:705:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel....
```diff diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index fe826fcf9990..7d10dd434f2e 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c @@ -702,7 +702,7 @@ static int max6697_probe(struct i2c_client *client) return -ENOMEM; if (client->dev.of_node) - data->type = (enum chips)o...
026738ecd077c83737ec87ecda2fb350c2bcebae
Analyze and fix the following issue in the Linux kernel code: hwmon: (max20730) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip_id' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: max20730.c:719:13: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.ker...
```diff diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c index 6df4c5b75bdc..d56ec24764fd 100644 --- a/drivers/hwmon/pmbus/max20730.c +++ b/drivers/hwmon/pmbus/max20730.c @@ -716,7 +716,7 @@ static int max20730_probe(struct i2c_client *client) } if (client->dev.of_node) - chip_id = (e...
1ef2ebf2631221cf6ee975be81e95cb512f43346
Analyze and fix the following issue in the Linux kernel code: hwmon: (lm90) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'kind' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: lm90.c:2768:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.or...
```diff diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index b25ae8b7ec90..e0d7454a301c 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2765,7 +2765,7 @@ static int lm90_probe(struct i2c_client *client) /* Set the device type */ if (client->dev.of_node) - data->kind = (enum chips)of_de...
8d84910a27ddd5c4a83df712424b7cab4ed95d3d
Analyze and fix the following issue in the Linux kernel code: hwmon: (lm85) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: lm85.c:1562:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.or...
```diff diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 2a62ea7b25a9..68c210002357 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -1559,7 +1559,7 @@ static int lm85_probe(struct i2c_client *client) data->client = client; if (client->dev.of_node) - data->type = (enum chips)of_devic...
c7e07faa48512f4beafef54b144a1e6df25c727f
Analyze and fix the following issue in the Linux kernel code: hwmon: (lm75) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'kind' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: lm75.c:581:10: error: cast to smaller integer type 'enum lm75_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel...
```diff diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index bcfa8193e5e7..5b2ea05c951e 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -578,7 +578,7 @@ static int lm75_probe(struct i2c_client *client) enum lm75_type kind; if (client->dev.of_node) - kind = (enum lm75_type)of_device_get_...
d96e79d00ffbdac475a46e7e25d201b94e8dcea2
Analyze and fix the following issue in the Linux kernel code: hwmon: (lm63) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'kind' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: lm63.c:1108:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.or...
```diff diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 562c94c7d831..0878a044dd8e 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -1105,7 +1105,7 @@ static int lm63_probe(struct i2c_client *client) /* Set the device type */ if (client->dev.of_node) - data->kind = (enum chips)of_de...
4a2a41dfff69ddc2bf9f1ac76fd7e98ab982f105
Analyze and fix the following issue in the Linux kernel code: hwmon: (ina2xx) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ina2xx.c:627:10: error: cast to smaller integer type 'enum ina2xx_ids' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.ker...
```diff diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c index a47973e2d606..d8415d1f21fc 100644 --- a/drivers/hwmon/ina2xx.c +++ b/drivers/hwmon/ina2xx.c @@ -624,7 +624,7 @@ static int ina2xx_probe(struct i2c_client *client) enum ina2xx_ids chip; if (client->dev.of_node) - chip = (enum ina2xx_ids)of...
3ff0befaefeffd92c828b961ba3a582490bab777
Analyze and fix the following issue in the Linux kernel code: hwmon: (ads7828) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ads7828.c:142:10: error: cast to smaller integer type 'enum ads7828_chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore...
```diff diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index e86894e35639..809e830f52a6 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c @@ -139,8 +139,7 @@ static int ads7828_probe(struct i2c_client *client) } if (client->dev.of_node) - chip = (enum ads7828_chips) - of_device...
c8b73e42f5bbc9ac134192d57bcc19ff225c95ad
Analyze and fix the following issue in the Linux kernel code: hwmon: (ad7418) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: ad7418.c:256:16: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.o...
```diff diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c index bcea66eac82b..4829f83ff52e 100644 --- a/drivers/hwmon/ad7418.c +++ b/drivers/hwmon/ad7418.c @@ -253,7 +253,7 @@ static int ad7418_probe(struct i2c_client *client) mutex_init(&data->lock); data->client = client; if (dev->of_node) - data->t...
3fc59546a6412374d5dc4d0e127ead6b85ed7f6e
Analyze and fix the following issue in the Linux kernel code: hwmon: (adt7475) fix Wvoid-pointer-to-enum-cast warning
Problem Details: 'chip' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: adt7475.c:1655:10: error: cast to smaller integer type 'enum chips' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel...
```diff diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 5363254644da..03acadc3a6cb 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1652,7 +1652,7 @@ static int adt7475_probe(struct i2c_client *client) i2c_set_clientdata(client, data); if (client->dev.of_node) - chip = ...
43fbe66dc2164c03e7a58dfcf0ab737b2f12cc79
Analyze and fix the following issue in the Linux kernel code: hwmon: Add driver for Renesas HS3001
Problem Details: Add base support for Renesas HS3001 temperature and humidity sensors and its compatibles HS3002, HS3003 and HS3004. The sensor has a fix I2C address 0x44. The resolution is fixed to 14bit (ref. Missing feature). Missing feature: - Accessing non-volatile memory: Custom board has no possibility to co...
```diff diff --git a/Documentation/hwmon/hs3001.rst b/Documentation/hwmon/hs3001.rst new file mode 100644 index 000000000000..9f59dfc212d9 --- /dev/null +++ b/Documentation/hwmon/hs3001.rst @@ -0,0 +1,37 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver HS3001 +==================== + +Supported chips: +...
311cb3638e9c98e974dee03438c671b722154969
Analyze and fix the following issue in the Linux kernel code: hwmon: (hp-wmi-sensors) Initialize pevents in hp_wmi_sensors_init()
Problem Details: The following warning is given by the Smatch static checker: drivers/hwmon/hp-wmi-sensors.c:1937 hp_wmi_sensors_init() error: uninitialized symbol 'pevents'. If there are no instances of the HPBIOS_PlatformEvents WMI object available, init_platform_events() never initializes this pointer, which m...
```diff diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c index 3a99cc5f44b2..17ae62f88bbf 100644 --- a/drivers/hwmon/hp-wmi-sensors.c +++ b/drivers/hwmon/hp-wmi-sensors.c @@ -1913,7 +1913,7 @@ static bool add_event_handler(struct hp_wmi_sensors *state) static int hp_wmi_sensors_init(struct ...
acda945afb465e2a2c436623a35203d63994441f
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/mp2975) Fix PGOOD in READ_STATUS_WORD
Problem Details: MP2973 & MP2971 return PGOOD instead of PB_STATUS_POWER_GOOD_N. Fix that in the read_word_data hook. MP2975 should not be affected, but that has not been confirmed with hardware. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com...
```diff diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c index 28f33f4618fa..26ba50633100 100644 --- a/drivers/hwmon/pmbus/mp2975.c +++ b/drivers/hwmon/pmbus/mp2975.c @@ -380,6 +380,11 @@ static int mp2975_read_word_data(struct i2c_client *client, int page, int ret; switch (reg) { + case P...
b4389ee5274535fd22966a188a048624fe700b70
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/mp2975) Fix whitespace error
Problem Details: Fix whitespace error reported by checkpatch.pl Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> Link: https://lore.kernel.org/r/20230714135124.2645339-1-Naresh.Solanki@9elements.com Signed-off-by: Guenter Roeck <linux@roeck-us....
```diff diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c index 2109b0458a8b..130cfde52e42 100644 --- a/drivers/hwmon/pmbus/mp2975.c +++ b/drivers/hwmon/pmbus/mp2975.c @@ -600,7 +600,7 @@ mp2975_vout_ov_scale_get(struct i2c_client *client, struct mp2975_data *data, if (ret < 0) return ret; ...
170fea88170796562a95e561a486f8403cfc747d
Analyze and fix the following issue in the Linux kernel code: hwmon: (pmbus/max20730) Remove strlcpy occurences
Problem Details: strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with direct assignment. ...
```diff diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c index 6f99085c2c3b..6df4c5b75bdc 100644 --- a/drivers/hwmon/pmbus/max20730.c +++ b/drivers/hwmon/pmbus/max20730.c @@ -114,6 +114,7 @@ static ssize_t max20730_debugfs_read(struct file *file, char __user *buf, const struct pmbus_driver...
9c53fb0ad1acaf227718ccae16e8fb8e01c05918
Analyze and fix the following issue in the Linux kernel code: hwmon: (asus-ec-sensosrs) fix mutex path for X670E Hero
Problem Details: A user reported that they observe race condition warning [1] and after looking once again into the DSDT source it was found that wrong mutex was used. [1] https://github.com/zeule/asus-ec-sensors/issues/43 Fixes: 790dec13c012 ("hwmon: (asus-ec-sensors) add ROG Crosshair X670E Hero.") Signed-off-by: E...
```diff diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c index f52a539eb33e..51f9c2db403e 100644 --- a/drivers/hwmon/asus-ec-sensors.c +++ b/drivers/hwmon/asus-ec-sensors.c @@ -340,7 +340,7 @@ static const struct ec_board_info board_info_crosshair_x670e_hero = { .sensors = SENSOR_TEMP_CP...
b8af10062df3c23fe002c3f187389bb263b3eb20
Analyze and fix the following issue in the Linux kernel code: perf vendor events arm64: Remove L1D_CACHE_LMISS from AmpereOne list
Problem Details: amperene/cache.json file tried to include L1D_CACHE_LMISS while it doesn't exist in common-and-microarch.json. While this bug doesn't seem to cause issue in newer kernels with jevents.py script, it prevents building older perf tools with the backported patch. Fixes: a9650b7f6fc09d16 ("perf vendor even...
```diff diff --git a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/cache.json b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/cache.json index fc0633054211..7a2b7b200f14 100644 --- a/tools/perf/pmu-events/arch/arm64/ampere/ampereone/cache.json +++ b/tools/perf/pmu-events/arch/arm64/ampere/ampereone/cache.json @...
92e1229b204d66525ee95054188938142420324d
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: test invalid splitting when skipping pinned drop extent_map
Problem Details: This reproduces the bug fixed by "btrfs: fix incorrect splitting in btrfs_drop_extent_map_range", we were improperly calculating the range for the split extent. Add a test that exercises this scenario and validates that we get the correct resulting extent_maps in our tree. Reviewed-by: Filipe Manana ...
```diff diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c index 31de4cd0666f..29bdd08b241f 100644 --- a/fs/btrfs/tests/extent-map-tests.c +++ b/fs/btrfs/tests/extent-map-tests.c @@ -708,6 +708,141 @@ out: return ret; } +/* + * Regression test for btrfs_drop_extent_map_range. Calli...
f345dbdf2c9c4733d52b9389da6c02672f3b8672
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: add a test for btrfs_add_extent_mapping
Problem Details: This helper is different from the normal add_extent_mapping in that it will stuff an em into a gap that exists between overlapping em's in the tree. It appeared there was a bug so I wrote a self test to validate it did the correct thing when it worked with two side by side ems. Thankfully it is correc...
```diff diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c index cf85c7795686..31de4cd0666f 100644 --- a/fs/btrfs/tests/extent-map-tests.c +++ b/fs/btrfs/tests/extent-map-tests.c @@ -655,6 +655,59 @@ out: return ret; } +/* + * Test the btrfs_add_extent_mapping helper which will atte...
ae76d8e3e1351aa1ba09cc68dab6866d356f2e17
Analyze and fix the following issue in the Linux kernel code: btrfs: scrub: fix grouping of read IO
Problem Details: [REGRESSION] There are several regression reports about the scrub performance with v6.4 kernel. On a PCIe 3.0 device, the old v6.3 kernel can go 3GB/s scrub speed, but v6.4 can only go 1GB/s, an obvious 66% performance drop. [CAUSE] Iostat shows a very different behavior between v6.3 and v6.4 kernel:...
```diff diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index d04fd3c6e927..11f943e86894 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -43,9 +43,20 @@ struct scrub_ctx; /* * The following value only influences the performance. * - * This determines the batch size for stripe submitted in one go. + * This...
3c771c194402ffe20d4de68d9fc21e703179a9ce
Analyze and fix the following issue in the Linux kernel code: btrfs: scrub: avoid unnecessary csum tree search preparing stripes
Problem Details: One of the bottleneck of the new scrub code is the extra csum tree search. The old code would only do the csum tree search for each scrub bio, which can be as large as 512KiB, thus they can afford to allocate a new path each time. But the new scrub code is doing csum tree search for each stripe, whic...
```diff diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 696bf695d8eb..1ce5dd154499 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -597,29 +597,37 @@ fail: * Each bit represents a sector. Thus caller should ensure @csum_buf passed * in is large enough to contain all csums. */ -int b...
1dc4888e725dc748b82858984f2a5bd41efc5201
Analyze and fix the following issue in the Linux kernel code: btrfs: scrub: avoid unnecessary extent tree search preparing stripes
Problem Details: Since commit e02ee89baa66 ("btrfs: scrub: switch scrub_simple_mirror() to scrub_stripe infrastructure"), scrub no longer re-use the same path for extent tree search. This can lead to unnecessary extent tree search, especially for the new stripe based scrub, as we have way more stripes to prepare. Thi...
```diff diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 8381174bda15..6aabce141d65 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -175,6 +175,7 @@ struct scrub_ctx { struct scrub_stripe stripes[SCRUB_STRIPES_PER_SCTX]; struct scrub_stripe *raid56_data_stripes; struct btrfs_fs_info *fs_info; + stru...
6bfe3959b0e7a526f5c64747801a8613f002f05a
Analyze and fix the following issue in the Linux kernel code: btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super
Problem Details: The function btrfs_validate_super() should verify the metadata_uuid in the provided superblock argument. Because, all its callers expect it to do that. Such as in the following stacks: write_all_supers() sb = fs_info->super_for_commit; btrfs_validate_write_super(.., sb) btrfs_validate_su...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 49f405495e34..32ec651c570f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2391,13 +2391,11 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (btrfs_fs_incompat(fs_info, METADATA_UUID) && - memcmp(f...
d167aa76dc0683828588c25767da07fb549e4f48
Analyze and fix the following issue in the Linux kernel code: btrfs: use the correct superblock to compare fsid in btrfs_validate_super
Problem Details: The function btrfs_validate_super() should verify the fsid in the provided superblock argument. Because, all its callers expect it to do that. Such as in the following stack: write_all_supers() sb = fs_info->super_for_commit; btrfs_validate_write_super(.., sb) btrfs_validate...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 48faf9c968d0..49f405495e34 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2384,11 +2384,10 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid...
7f72f50547b7af4ddf985b07fc56600a4deba281
Analyze and fix the following issue in the Linux kernel code: btrfs: output extra debug info if we failed to find an inline backref
Problem Details: [BUG] Syzbot reported several warning triggered inside lookup_inline_extent_backref(). [CAUSE] As usual, the reproducer doesn't reliably trigger locally here, but at least we know the WARN_ON() is triggered when an inline backref can not be found, and it can only be triggered when @insert is true. (I....
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e0508114f0bd..105f528382e7 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -848,6 +848,11 @@ again: err = -ENOENT; goto out; } else if (WARN_ON(ret)) { + btrfs_print_leaf(path->nodes[0]); + btrfs_err(fs_info, +"exte...
38dc88890de6cae3db5a33ece287e56fc9cc4ce6
Analyze and fix the following issue in the Linux kernel code: btrfs: consolidate the error handling in run_delalloc_nocow
Problem Details: Share the calls to extent_clear_unlock_delalloc for btrfs_path allocation failure handling and the normal exit path. This relies on btrfs_free_path ignoring a NULL pointer, and the initialization of cur_offset to start at the beginning of the function. Reviewed-by: Boris Burkov <boris@bur.io> Signed-...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1fb1e4ac4a8c..8d0dd266dd1b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1978,13 +1978,8 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, path = btrfs_alloc_path(); if (!path) { - extent_clear_unlock_delalloc(inode, sta...
953fa5ced510c4937075002bbfc6405cd500efef
Analyze and fix the following issue in the Linux kernel code: btrfs: fix error handling when in a COW window in run_delalloc_nocow
Problem Details: When run_delalloc_nocow has cow_start set to a value other than (u64)-1, it has delayed COW writeback pending behind cur_offset. When an error occurs in such a window, the range going back to cow_start and not just cur_offset needs to be unlocked, but only two error cases handle this correctly Move t...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f2ab27084cc4..0d973a959559 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2029,11 +2029,8 @@ next_slot: leaf = path->nodes[0]; if (path->slots[0] >= btrfs_header_nritems(leaf)) { ret = btrfs_next_leaf(root, path); - if (ret < 0) { - ...
332581bde2a419d5f12a93a1cdc2856af649a3cc
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: do not zone finish data relocation block group
Problem Details: When multiple writes happen at once, we may need to sacrifice a currently active block group to be zone finished for a new allocation. We choose a block group with the least free space left, and zone finish it. To do the finishing, we need to send IOs for already allocated region and wait for them and...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ba22790f95f7..e0508114f0bd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3738,7 +3738,8 @@ static int do_allocation_zoned(struct btrfs_block_group *block_group, fs_info->data_reloc_bg == 0); if (block_group->r...
e7f1326cc24e22b38afc3acd328480a1183f9e79
Analyze and fix the following issue in the Linux kernel code: btrfs: set page extent mapped after read_folio in relocate_one_page
Problem Details: One of the CI runs triggered the following panic assertion failed: PagePrivate(page) && page->private, in fs/btrfs/subpage.c:229 ------------[ cut here ]------------ kernel BUG at fs/btrfs/subpage.c:229! Internal error: Oops - BUG: 00000000f2000800 [#1] SMP CPU: 0 PID: 923660 Comm: btrfs Not...
```diff diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 8ff0e9dcf85c..7408e48d45bc 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3006,9 +3006,6 @@ static int relocate_one_page(struct inode *inode, struct file_ra_state *ra, if (!page) return -ENOMEM; } - ret = set_page_exte...
cd361199ff23776481c37023a55d855d5ad5c0f5
Analyze and fix the following issue in the Linux kernel code: btrfs: wait on uncached block groups on every allocation loop
Problem Details: My initial fix for the generic/475 hangs was related to metadata, but our CI testing uncovered another case where we hang for similar reasons. We again have a task with a plug that is holding an outstanding request that is keeping the dm device from finishing it's suspend, and that task is stuck in the...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3c62a7eaf24b..ba22790f95f7 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3481,7 +3481,6 @@ btrfs_release_block_group(struct btrfs_block_group *cache, * Helper function for find_free_extent(). * * Return -ENOENT to in...
257614301a5db9f7b0548584ca207ad7785c8b89
Analyze and fix the following issue in the Linux kernel code: btrfs: handle errors properly in update_inline_extent_backref()
Problem Details: [PROBLEM] Inside function update_inline_extent_backref(), we have several BUG_ON()s along with some ASSERT()s which can be triggered by corrupted filesystem. [ANAYLYSE] Most of those BUG_ON()s and ASSERT()s are just a way of handling unexpected on-disk data. Although we have tree-checker to rule out ...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index bc9ff192196f..3c62a7eaf24b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -381,11 +381,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, } } + WARN_ON(1); btrfs_print_leaf(eb); btrfs_err(e...
5b135b382a360f4c87cf8896d1465b0b07f10cb0
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: re-enable metadata over-commit for zoned mode
Problem Details: Now that, we can re-enable metadata over-commit. As we moved the activation from the reservation time to the write time, we no longer need to ensure all the reserved bytes is properly activated. Without the metadata over-commit, it suffers from lower performance because it needs to flush the delalloc ...
```diff diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 356638f54fef..d7e8cd4f140c 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -389,11 +389,7 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, return 0; used = btrfs_space_info_used(space_info, true); - if (test_bit(...
13bb483d32abb6f8ebd40141d87eb68f11cc2dd2
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: activate metadata block group on write time
Problem Details: In the current implementation, block groups are activated at reservation time to ensure that all reserved bytes can be written to an active metadata block group. However, this approach has proven to be less efficient, as it activates block groups more frequently than necessary, putting pressure on the ...
```diff diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index a127865f49f9..b0e432c30e1d 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -4287,6 +4287,17 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) struct btrfs_caching_control *caching_ctl; struct rb_node *n; + if (...
a7f8de500e28bb227e02a7bd35988cf37b816c86
Analyze and fix the following issue in the Linux kernel code: btrfs: return real error when orphan cleanup fails due to a transaction abort
Problem Details: During mount we will call btrfs_orphan_cleanup() to remove any inodes that were previously deleted (have a link count of 0) but for which we were not able before to remove their items from the subvolume tree. The removal of the items will happen by triggering eviction, when we do the final iput() on th...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 19dc0b8ff427..431007e443a8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3509,9 +3509,16 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) */ if (found_key.offset == last_objectid) { + /* + * We found the same inode as before. Th...
4490e803e1fe9fab8db5025e44e23b55df54078b
Analyze and fix the following issue in the Linux kernel code: btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART
Problem Details: When joining a transaction with TRANS_JOIN_NOSTART, if we don't find a running transaction we end up creating one. This goes against the purpose of TRANS_JOIN_NOSTART which is to join a running transaction if its state is at or below the state TRANS_STATE_COMMIT_START, otherwise return an -ENOENT error...
```diff diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 815f61d6b506..6a2a12593183 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -292,10 +292,11 @@ loop: spin_unlock(&fs_info->trans_lock); /* - * If we are ATTACH, we just want to catch the current transaction, - * and co...
257deed2a955fd73cc1ef53a96583edeab3ece1a
Analyze and fix the following issue in the Linux kernel code: btrfs: tests: enhance extent buffer bitmap tests
Problem Details: Enhance extent bitmap tests for the following aspects: - Remove unnecessary @len from __test_eb_bitmaps() We can fetch the length from extent buffer - Explicitly distinguish bit and byte length Now every start/len inside bitmap tests would have either "byte_" or "bit_" prefix to make it more ex...
```diff diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c index f6bc6d738555..3e625c558b0b 100644 --- a/fs/btrfs/tests/extent-io-tests.c +++ b/fs/btrfs/tests/extent-io-tests.c @@ -319,86 +319,139 @@ out: return ret; } -static int check_eb_bitmap(unsigned long *bitmap, struct extent_b...
256b0cf90d2a052f546bc118784574298c5818f2
Analyze and fix the following issue in the Linux kernel code: btrfs: fix zoned handling in submit_uncompressed_range
Problem Details: For zoned file systems we need to use run_delalloc_zoned to submit writeback, as we need to write out partial allocations when running into zone active limits. submit_uncompressed_range currently always calls cow_file_range to allocate blocks and thus misses the active zone limits handling. Fix this ...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 29a137d55cf2..19dc0b8ff427 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -125,10 +125,10 @@ static struct kmem_cache *btrfs_inode_cachep; static int btrfs_setsize(struct inode *inode, struct iattr *attr); static int btrfs_truncate(struct btrfs_i...
44962ca37c8cf882ba72e4cd67f30eaecb920a52
Analyze and fix the following issue in the Linux kernel code: btrfs: don't redirty pages in compress_file_range
Problem Details: compress_file_range needs to clear the dirty bit before handing off work to the compression worker threads to prevent processes coming in through mmap and changing the file contents while the compression is accessing the data (See commit 4adaa611020f ("Btrfs: fix race between mmap writes and compressio...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 08fb26d58172..bcf8244d8e1a 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -181,22 +181,6 @@ void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end) } } -void extent_range_redirty_for_io(struct inode *inode...
84f262f00910996f6cfd27094b9bca9422c630d4
Analyze and fix the following issue in the Linux kernel code: btrfs: reduce debug spam from submit_compressed_extents
Problem Details: Move the printk that is supposed to help to debug failures in submit_one_async_extent into submit_one_async_extent and make it coniditonal on actually having an error condition instead of spamming the log unconditionally. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index eb06c7c8d6c1..bd62985c3520 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1179,11 +1179,11 @@ static int submit_uncompressed_range(struct btrfs_inode *inode, return ret; } -static int submit_one_async_extent(struct btrfs_inode *inode, - ...
53ffb30a784d30db4d4cd074b4da46fa2472ab60
Analyze and fix the following issue in the Linux kernel code: btrfs: don't create inline extents in fallback_to_cow
Problem Details: For NOCOW files, run_delalloc_nocow can still fall back to COW allocations when required and calls to fallback_to_cow helper for that. For such an allocation we can have multiple ordered_extents for existing extents that NOCOW overwrites and new allocations that fallback_to_cow creates. If one of the...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 820444fbb564..aa1cda22a23a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -129,7 +129,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode, struct page *locked_page, u64 start, u64 end, int *page_started, unsign...
a6496849671a5bc9218ecec25a983253b34351b1
Analyze and fix the following issue in the Linux kernel code: btrfs: fix start transaction qgroup rsv double free
Problem Details: btrfs_start_transaction reserves metadata space of the PERTRANS type before it identifies a transaction to start/join. This allows flushing when reserving that space without a deadlock. However, it results in a race which temporarily breaks qgroup rsv accounting. T1 ...
```diff diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 4bb9716ad24a..815f61d6b506 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -591,8 +591,13 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, u64 delayed_refs_bytes = 0; qgroup_reserved = num_items *...
3b9f0995d819157f1d2b37ad291ad6c7eb8b762f
Analyze and fix the following issue in the Linux kernel code: btrfs: rename add_new_free_space() to btrfs_add_new_free_space()
Problem Details: Since add_new_free_space() is exported, used outside block-group.c, rename it to include the 'btrfs_' prefix. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
```diff diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 5ea515fc8c16..7bd1eee9367b 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -516,8 +516,8 @@ static void fragment_free_space(struct btrfs_block_group *block_group) * * Returns 0 on success or < 0 on error. */ -int add_ne...
07a3bb95ea1f7fa77e360cf3b0f06dff41dbf391
Analyze and fix the following issue in the Linux kernel code: btrfs: zoned: use vcalloc instead of for vzalloc in btrfs_get_dev_zone_info
Problem Details: Use vcalloc that checks potential multiplication overflows. The changes were done using Coccinelle semantic patch. Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Reviewed-by: David Sterb...
```diff diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 72b90bc19a19..b43c4536e685 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -465,8 +465,8 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) * use the cache. */ if (populate_cache && bdev_is_zoned(device->bdev)) ...
d8ce82efdece373b570f35acc8a29487b2087b84
Analyze and fix the following issue in the Linux kernel code: super: make locking naming consistent
Problem Details: Make the naming consistent with the earlier introduced super_lock_{read,write}() helpers. Reviewed-by: Jan Kara <jack@suse.cz> Message-Id: <20230818-vfs-super-fixes-v3-v3-2-9f0b1876e46b@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
```diff diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index aca4b4811394..969ce991b0b0 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1953,9 +1953,9 @@ static long __writeback_inodes_wb(struct bdi_writeback *wb, struct inode *inode = wb_inode(wb->b_io.prev); struct super_block *sb = inode->i_sb; ...
0ed33598ddf308782ca621755df5d23dcff34b64
Analyze and fix the following issue in the Linux kernel code: super: use locking helpers
Problem Details: Replace the open-coded {down,up}_{read,write}() calls with simple wrappers. Follow-up patches will benefit from this as well. Reviewed-by: Jan Kara <jack@suse.cz> Message-Id: <20230818-vfs-super-fixes-v3-v3-1-9f0b1876e46b@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
```diff diff --git a/fs/super.c b/fs/super.c index c878e7373f93..b12e2f247e1e 100644 --- a/fs/super.c +++ b/fs/super.c @@ -50,6 +50,42 @@ static char *sb_writers_name[SB_FREEZE_LEVELS] = { "sb_internal", }; +static inline void super_lock(struct super_block *sb, bool excl) +{ + if (excl) + down_write(&sb->s_umount...