{
        struct cnic_dev *dev;
 
-       if (ulp_type >= MAX_CNIC_ULP_TYPE) {
+       if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
                printk(KERN_ERR PFX "cnic_register_driver: Bad type %d\n",
                       ulp_type);
                return -EINVAL;
        struct cnic_ulp_ops *ulp_ops;
        int i = 0;
 
-       if (ulp_type >= MAX_CNIC_ULP_TYPE) {
+       if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
                printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n",
                       ulp_type);
                return -EINVAL;
        struct cnic_local *cp = dev->cnic_priv;
        struct cnic_ulp_ops *ulp_ops;
 
-       if (ulp_type >= MAX_CNIC_ULP_TYPE) {
+       if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
                printk(KERN_ERR PFX "cnic_register_device: Bad type %d\n",
                       ulp_type);
                return -EINVAL;
        struct cnic_local *cp = dev->cnic_priv;
        int i = 0;
 
-       if (ulp_type >= MAX_CNIC_ULP_TYPE) {
+       if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
                printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n",
                       ulp_type);
                return -EINVAL;