net/ice/base: support NVM access commands
[dpdk.git] / drivers / net / ice / base / ice_flex_pipe.c
index 29888df..7daaf10 100644 (file)
@@ -4200,7 +4200,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)
                                index = i + 1;
 
                        /* check for room */
-                       if (first_free + 1 < ice_fd_pairs[index].count)
+                       if (first_free + 1 < (s8)ice_fd_pairs[index].count)
                                return ICE_ERR_MAX_LIMIT;
 
                        /* place in extraction sequence */
@@ -4210,6 +4210,9 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)
                                es[first_free - k].off =
                                        ice_fd_pairs[index].off + (k * 2);
 
+                               if (k > first_free)
+                                       return ICE_ERR_OUT_OF_RANGE;
+
                                /* keep track of non-relevant fields */
                                mask_sel |= 1 << (first_free - k);
                        }
@@ -4915,8 +4918,10 @@ ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk,
                p->tcam[i].prof_id = map->prof_id;
                p->tcam[i].tcam_idx = ICE_INVALID_TCAM;
 
-               if (ice_ptg_find_ptype(hw, blk, map->ptype[i], &ptg))
+               if (ice_ptg_find_ptype(hw, blk, map->ptype[i], &ptg)) {
+                       ice_free(hw, p);
                        return ICE_ERR_CFG;
+               }
 
                p->tcam[i].ptg = ptg;
        }