aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-11-02 06:53:44 +0000
committerDavid S. Miller <davem@davemloft.net>2009-11-04 05:06:23 -0800
commit0d37f36ff9bc41067c71635d14b6a5834853a779 (patch)
tree85571370b58b1f4e5596219171cea0004727ddc7 /drivers/net/cnic.c
parentqlge: Clean up netdev->stats usage. (diff)
downloadlinux-dev-0d37f36ff9bc41067c71635d14b6a5834853a779.tar.xz
linux-dev-0d37f36ff9bc41067c71635d14b6a5834853a779.zip
cnic: ensure ulp_type is not negative
`ulp_type' is signed, make sure it is not negative when we read the array element. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index cfc6b208631a..e503384e2a54 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -408,7 +408,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
{
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;
@@ -454,7 +454,7 @@ int cnic_unregister_driver(int ulp_type)
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;
@@ -510,7 +510,7 @@ static int cnic_register_device(struct cnic_dev *dev, int ulp_type,
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;
@@ -551,7 +551,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
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;