Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e.h
Original file line number Diff line number Diff line change
Expand Up @@ -1306,4 +1306,15 @@ static inline struct i40e_pf *i40e_hw_to_pf(struct i40e_hw *hw)

struct device *i40e_hw_to_dev(struct i40e_hw *hw);

static inline u32 i40e_get_max_num_descriptors(const struct i40e_pf *pf)
{
const struct i40e_hw *hw = &pf->hw;

switch (hw->mac.type) {
case I40E_MAC_XL710:
return I40E_MAX_NUM_DESCRIPTORS_XL710;
default:
return I40E_MAX_NUM_DESCRIPTORS;
}
}
#endif /* _I40E_H_ */
12 changes: 0 additions & 12 deletions drivers/net/ethernet/intel/i40e/i40e_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2010,18 +2010,6 @@ static void i40e_get_drvinfo(struct net_device *netdev,
drvinfo->n_priv_flags += I40E_GL_PRIV_FLAGS_STR_LEN;
}

static u32 i40e_get_max_num_descriptors(struct i40e_pf *pf)
{
struct i40e_hw *hw = &pf->hw;

switch (hw->mac.type) {
case I40E_MAC_XL710:
return I40E_MAX_NUM_DESCRIPTORS_XL710;
default:
return I40E_MAX_NUM_DESCRIPTORS;
}
}

static void i40e_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
Expand Down
14 changes: 14 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,13 @@ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id,

/* only set the required fields */
tx_ctx.base = info->dma_ring_addr / 128;

/* ring_len has to be multiple of 8 */
if (!IS_ALIGNED(info->ring_len, 8) ||
info->ring_len > i40e_get_max_num_descriptors(pf)) {
ret = -EINVAL;
goto error_context;
}
tx_ctx.qlen = info->ring_len;
tx_ctx.rdylist = le16_to_cpu(vsi->info.qs_handle[0]);
tx_ctx.rdylist_act = 0;
Expand Down Expand Up @@ -720,6 +727,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,

/* only set the required fields */
rx_ctx.base = info->dma_ring_addr / 128;

/* ring_len has to be multiple of 32 */
if (!IS_ALIGNED(info->ring_len, 32) ||
info->ring_len > i40e_get_max_num_descriptors(pf)) {
ret = -EINVAL;
goto error_param;
}
rx_ctx.qlen = info->ring_len;

if (info->splithdr_enabled) {
Expand Down
9 changes: 7 additions & 2 deletions fs/squashfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
unsigned short flags;
unsigned int fragments;
u64 lookup_table_start, xattr_id_table_start, next_table;
int err;
int err, devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);

TRACE("Entered squashfs_fill_superblock\n");

Expand All @@ -160,6 +160,11 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)
return err;
}

if (!devblksize) {
errorf(fc, "squashfs: unable to set blocksize\n");
return -EINVAL;
}

sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL);
if (sb->s_fs_info == NULL) {
ERROR("Failed to allocate squashfs_sb_info\n");
Expand All @@ -169,7 +174,7 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)

msblk->panic_on_errors = (opts->errors == Opt_errors_panic);

msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
msblk->devblksize = devblksize;
msblk->devblksize_log2 = ffz(~msblk->devblksize);

mutex_init(&msblk->meta_index_mutex);
Expand Down
Loading