Skip to content

Commit

Permalink
octeontx2-af: fix array bound error
Browse files Browse the repository at this point in the history
This patch fixes below error by using proper data type.

drivers/net/ethernet/marvell/octeontx2/af/rpm.c: In function
'rpm_cfg_pfc_quanta_thresh':
include/linux/find.h:40:23: error: array subscript 'long unsigned
int[0]' is partly outside array bounds of 'u16[1]' {aka 'short unsigned
int[1]'} [-Werror=array-bounds]
   40 |                 val = *addr & GENMASK(size - 1, offset);

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Link: https://lore.kernel.org/r/20220211155539.13931-1-hkelam@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Hariprasad Kelam authored and Jakub Kicinski committed Feb 11, 2022
1 parent b96a792 commit 5f7dc7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/marvell/octeontx2/af/rpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,15 @@ int rpm_lmac_get_pause_frm_status(void *rpmd, int lmac_id,
return 0;
}

static void rpm_cfg_pfc_quanta_thresh(rpm_t *rpm, int lmac_id, u16 pfc_en,
static void rpm_cfg_pfc_quanta_thresh(rpm_t *rpm, int lmac_id,
unsigned long pfc_en,
bool enable)
{
u64 quanta_offset = 0, quanta_thresh = 0, cfg;
int i, shift;

/* Set pause time and interval */
for_each_set_bit(i, (unsigned long *)&pfc_en, 16) {
for_each_set_bit(i, &pfc_en, 16) {
switch (i) {
case 0:
case 1:
Expand Down

0 comments on commit 5f7dc7d

Please sign in to comment.