]> Git Repo - linux.git/blobdiff - drivers/gpio/gpio-sim.c
block: add a sanity check for non-write flush/fua bios
[linux.git] / drivers / gpio / gpio-sim.c
index 1020c2feb24964303c279fa352af7839991a8775..60514bc5454f8ceb258e0647910b91fd1642cd8e 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "gpiolib.h"
 
+#define GPIO_SIM_NGPIO_MAX     1024
 #define GPIO_SIM_PROP_MAX      4 /* Max 3 properties + sentinel. */
 #define GPIO_SIM_NUM_ATTRS     3 /* value, pull and sentinel */
 
@@ -371,6 +372,9 @@ static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev)
        if (ret)
                return ret;
 
+       if (num_lines > GPIO_SIM_NGPIO_MAX)
+               return -ERANGE;
+
        ret = fwnode_property_read_string(swnode, "gpio-sim,label", &label);
        if (ret) {
                label = devm_kasprintf(dev, GFP_KERNEL, "%s-%s",
This page took 0.035475 seconds and 4 git commands to generate.