Skip to contentSkip to conversation

Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

PATCH In review Srishti Sharma 3 participants 5 messages Sep 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/omap4iss/iss.c +1 -1
index c26c99fd..b1036ba 100644
@@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
 		return;
 
 	mutex_lock(&iss->iss_mutex);
-	BUG_ON(iss->ref_count == 0);
+	WARN_ON(iss->ref_count == 0);
 	if (--iss->ref_count == 0) {
 		iss_disable_interrupts(iss);
 		/* Reset the ISS if an entity has failed to stop. This is the

--
2.7.4

#1 lore raw
Quoted 12 lines · Srishti Sharma

Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/omap4iss/iss.c +0 -0
index c26c99fd..b1036ba 100644

drivers/staging/media/omap4iss/iss.c void omap4iss_put(struct iss_device *iss) · line 897

Quoted 6 lines
drivers/staging/media/omap4iss/iss.c +1 -1
@@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
 		return;
 
 	mutex_lock(&iss->iss_mutex);
-	BUG_ON(iss->ref_count == 0);
+	WARN_ON(iss->ref_count == 0);
 	if (--iss->ref_count == 0) {

Won't this then infinite loop?

julia

Quoted 12 lines
drivers/staging/media/omap4iss/iss.c +0 -1
 		iss_disable_interrupts(iss);
 		/* Reset the ISS if an entity has failed to stop. This is the
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1504879698-5855-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 18 lines · Julia Lawall
Quoted 14 lines · Srishti Sharma

Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/omap4iss/iss.c +0 -0
index c26c99fd..b1036ba 100644
@@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
              return;
 
Quoted 6 lines

drivers/staging/media/omap4iss/iss.c void omap4iss_put(struct iss_device *iss) · line 897

Quoted 4 lines
drivers/staging/media/omap4iss/iss.c +1 -1
      mutex_lock(&iss->iss_mutex);
-     BUG_ON(iss->ref_count == 0);
+     WARN_ON(iss->ref_count == 0);
      if (--iss->ref_count == 0) {

Won't this then infinite loop?

Oh.. yes ! It would, sorry . Please drop this patch .

Regards,
Srishti

Quoted 15 lines

julia

Quoted 12 lines
drivers/staging/media/omap4iss/iss.c +0 -1
              iss_disable_interrupts(iss);
              /* Reset the ISS if an entity has failed to stop. This is the
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1504879698-5855-1-git-send-email-srishtishar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
In reply to Srishti Sharma
Quoted 12 lines · Srishti Sharma

Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/omap4iss/iss.c +0 -0
index c26c99fd..b1036ba 100644

drivers/staging/media/omap4iss/iss.c void omap4iss_put(struct iss_device *iss) · line 896

Quoted 5 lines
drivers/staging/media/omap4iss/iss.c +1 -1
@@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
 		return;
 
 	mutex_lock(&iss->iss_mutex);
-	BUG_ON(iss->ref_count == 0);
+	WARN_ON(iss->ref_count == 0);

ref_counting bugs often have a security aspect. BUG_ON() is probably safer here. Better to crash than to lose all your bitcoin.

regards,
dan carpenter

#4 lore raw
Quoted 15 lines · Dan Carpenter
Quoted 14 lines · Srishti Sharma

Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/omap4iss/iss.c +0 -0
index c26c99fd..b1036ba 100644
@@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
              return;
 
Quoted 6 lines

drivers/staging/media/omap4iss/iss.c void omap4iss_put(struct iss_device *iss) · line 896

Quoted 3 lines
drivers/staging/media/omap4iss/iss.c +1 -1
      mutex_lock(&iss->iss_mutex);
-     BUG_ON(iss->ref_count == 0);
+     WARN_ON(iss->ref_count == 0);

ref_counting bugs often have a security aspect. BUG_ON() is probably safer here. Better to crash than to lose all your bitcoin.

Okay, Thanks for this.

Regards,
Srishti

Quoted 4 lines

regards,
dan carpenter