In function agp_3_5_enable from drivers/char/agp/isoch.c, the
variable ndevs may remain zero if all AGP devices have type of
"Bridge" or "Unclassified device". Passing ndevs==0 to function
 agp_3_5_isochronous_node_enable or agp_3_5_nonisochronous_node_enable
will lead to divide by zero problems.

Signed-off-by: Yiyuan GUO <[email protected]>
---
 drivers/char/agp/isoch.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c
index 7ecf20a6d..4c21bb057 100644
--- a/drivers/char/agp/isoch.c
+++ b/drivers/char/agp/isoch.c
@@ -433,6 +433,11 @@ int agp_3_5_enable(struct agp_bridge_data *bridge)
                }
        }               
 
+       if (!ndevs) {
+               ret = -ENODEV;
+               goto free_and_exit;
+       }
+
        /*
         * Call functions to divide target resources amongst the AGP 3.0
         * masters.  This process is dramatically different depending on
-- 
2.25.1

Reply via email to