]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Staging: bcm: silence off by one warning
authorDan Carpenter <error27@gmail.com>
Fri, 8 Oct 2010 13:49:04 +0000 (15:49 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Oct 2010 14:29:57 +0000 (07:29 -0700)
"status" is used as an index into the Adapter->PackInfo[] array, which
has NO_OF_QUEUES elements.

This code actually works OK.  The SearchSfid() function always returns
a valid index or it returns NO_OF_QUEUES + 1.  But it looks sloppy and
it makes the static checkers complain.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/bcm/CmHost.c
drivers/staging/bcm/Qos.c

index b4113923e3ed4785badc476e6179701c03a1f14d..6f388a374ddc5dde23867c49d29ba5a25f95505d 100644 (file)
@@ -2367,8 +2367,7 @@ int get_dsx_sf_data_to_application(PMINI_ADAPTER Adapter, UINT uiSFId, void __us
        struct _packet_info *psSfInfo=NULL;
        BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "status =%d",status);
        status = SearchSfid(Adapter, uiSFId);
-       if(status>NO_OF_QUEUES)
-       {
+       if (status >= NO_OF_QUEUES) {
                BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "SFID %d not present in queue !!!", uiSFId );
                return -EINVAL;
        }
index 913a1e1dc28dfb1f0137c69cec79368052687735..75b2b879633f6f845632ebf911d2b8e894088ef2 100644 (file)
@@ -587,8 +587,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb)
                        pstClassifierRule = &Adapter->astClassifierTable[uiLoopIndex];
 
                        uiSfIndex = SearchSfid(Adapter,pstClassifierRule->ulSFID);
-                       if(uiSfIndex > NO_OF_QUEUES)
-                       {
+                       if (uiSfIndex >= NO_OF_QUEUES) {
                                BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,  "Queue Not Valid. SearchSfid for this classifier Failed\n");
                                break;
                        }