Noticed the problem trying to apply the hunk below.  It applies just
fine with git, but fails to apply with GNU patch.  Cutting the 7-line
context above the patch down to 3-line context fixes the issue.  Cutting
it down to 5-line context makes it apply with fuzz 2.

The context matches the file to be patched and I believe the problem to
be generic.  Actual patch only serves illustration.

---<snip>---
@@ -599,14 +600,20 @@ static void bcon_init_zero_bio(struct blockconsole *bc)
 static int blockconsole_panic(struct notifier_block *this, unsigned long event,
                void *ptr)
 {
        struct blockconsole *bc = container_of(this, struct blockconsole,
 static int blockconsole_panic(struct notifier_block *this, unsigned long event,
                void *ptr)
 {
        struct blockconsole *bc = container_of(this, struct blockconsole,
                        panic_block);
        unsigned int n;
 
-       n = SECTOR_SIZE - bcon_console_ofs(bc);
-       if (n != SECTOR_SIZE)
-               bcon_advance_console_bytes(bc, n);
-       bcon_write_iteration(bc);
+       if (have_hardware_watchdog) {
+               /*
+                * Without a hardware watchdog, this has potential to
+                * hang the machine.
+                */
+               n = SECTOR_SIZE - bcon_console_ofs(bc);
+               if (n != SECTOR_SIZE)
+                       bcon_advance_console_bytes(bc, n);
+               bcon_write_iteration(bc);
+       }
        return NOTIFY_DONE;
 }
 
---<snap>---

Jörn

--
Any headline which ends in a question mark can be answered by the word 'no'.
-- Betteridge's Law

Reply via email to