Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a8b652b

Browse files
JordymaloneEricccTaiwan
andauthored
Fix incorrect gpio_free_array usage (#339)
The gpio_free_array function was incorrectly passed ARRAY_SIZE(leds) when freeing the 'buttons' array in multiple examples: - examples/intrp.c - examples/bottomhalf.c - examples/bh_halfthreaded.c This mismatch could lead to invalid memory access if the size of 'buttons' differs from 'leds'. Updated all occurrences to use ARRAY_SIZE(buttons) for correctness. Co-authored-by: EricccTaiwan <yphbchou0911@gmail.com> Signed-off-by: Jordan Chiu <jordan871130@gmail.com>
1 parent e50123f commit a8b652b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

‎examples/bh_threaded.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static int __init bottomhalf_init(void)
171171
free_irq(button_irqs[0], &buttons[0]);
172172

173173
fail2:
174-
gpio_free_array(buttons, ARRAY_SIZE(leds));
174+
gpio_free_array(buttons, ARRAY_SIZE(buttons));
175175

176176
fail1:
177177
gpio_free_array(leds, ARRAY_SIZE(leds));

‎examples/bottomhalf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int __init bottomhalf_init(void)
189189
free_irq(button_irqs[0], NULL);
190190

191191
fail2:
192-
gpio_free_array(buttons, ARRAY_SIZE(leds));
192+
gpio_free_array(buttons, ARRAY_SIZE(buttons));
193193

194194
fail1:
195195
gpio_free_array(leds, ARRAY_SIZE(leds));

‎examples/intrpt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static int __init intrpt_init(void)
165165
free_irq(button_irqs[0], NULL);
166166

167167
fail2:
168-
gpio_free_array(buttons, ARRAY_SIZE(leds));
168+
gpio_free_array(buttons, ARRAY_SIZE(buttons));
169169

170170
fail1:
171171
gpio_free_array(leds, ARRAY_SIZE(leds));

‎lkmpg.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ \subsection{Spinlocks}
17781778
In contrast, \cpp|spin_lock_irqsave()| disables interrupts and also saves the interrupt state, ensuring that interrupts are restored to their previous state when the lock is released.
17791779
This makes \cpp|spin_lock_irqsave()| a safer option in scenarios where preserving the interrupt state is crucial.
17801780

1781-
Next, \cpp|spin_lock_bh()| disables softirqs (software interrupts) but allows hardware interrupts to continue.
1781+
Next, \cpp|spin_lock_bh()| disables \textbf{softirqs} (software interrupts) but allows hardware interrupts to continue.
17821782
Unlike \cpp|spin_lock_irq()| and \cpp|spin_lock_irqsave()|, which disable both hardware and software interrupts, \cpp|spin_lock_bh()| is useful when hardware interrupts need to remain active.
17831783

17841784
For more information about spinlock usage and lock types, see the following resources:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /