staging: speakup: Replace BUG_ON() with WARN_ON().
PATCH 1/1 staging: speakup: Replace BUG_ON() with WARN_ON().
BUG_ON() is replaced with WARN_ON() to fix the following checkpatch issue:
Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON().
Signed-off-by Varsha Rao <[email protected]>
--- drivers/staging/speakup/kobjects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/speakup/kobjects.c +2 -2
@@ -833,7 +833,7 @@ static ssize_t message_show(struct kobject *kobj,struct msg_group_t *group =spk_find_msg_group (attr->attr.name);unsigned long flags; -BUG_ON (!group); +WARN_ON (!group);spin_lock_irqsave (&speakup_info.spinlock, flags); retval =message_show_helper (buf, group->start, group->end);spin_unlock_irqrestore (&speakup_info.spinlock, flags);
@@ -845,7 +845,7 @@ static ssize_t message_store(struct kobject *kobj, struct kobj_attribute *attr, {struct msg_group_t *group =spk_find_msg_group (attr->attr.name); -BUG_ON (!group); +WARN_ON (!group);return message_store_helper (buf, count, group); }
Signature · 1 line
2.9.3
drivers/staging/speakup/kobjects.c static ssize_t message_show(struct kobject *kobj, · line 838
Quoted 10 lines · Varsha Rao
BUG_ON()is replaced withWARN_ON()to fix the following checkpatch issue:Avoid crashing the kernel - try using
WARN_ON& recovery code rather thanBUG()orBUG_ON().drivers/staging/speakup/kobjects.c +1
-1-BUG_ON (!group); +WARN_ON (!group);spin_lock_irqsave (&speakup_info.spinlock, flags); retval =message_show_helper (buf, group->start, group->end);
You are still crashing the kernel by dereferencing a NULL pointer here.
When you use WARN_ON, the kernel must have some way of continuing without crashing immediately.
Arnd