提交 f9a703e1 编写于 作者: D Dan Carpenter 提交者: John W. Linville

iwmc3200wifi: add a range check to iwm_cfg80211_get_key()

Smatch complains that "key_index" is capped at 5 in nl80211_get_key()
but iwm->keys[] only has 4 elements.  I don't know if this is really
needed, but the other ->get_key() implementations seemed to check
for overflows so I've added a check here.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 d83579e2
...@@ -187,13 +187,17 @@ static int iwm_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -187,13 +187,17 @@ static int iwm_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
struct key_params*)) struct key_params*))
{ {
struct iwm_priv *iwm = ndev_to_iwm(ndev); struct iwm_priv *iwm = ndev_to_iwm(ndev);
struct iwm_key *key = &iwm->keys[key_index]; struct iwm_key *key;
struct key_params params; struct key_params params;
IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index); IWM_DBG_WEXT(iwm, DBG, "Getting key %d\n", key_index);
if (key_index >= IWM_NUM_KEYS)
return -ENOENT;
memset(&params, 0, sizeof(params)); memset(&params, 0, sizeof(params));
key = &iwm->keys[key_index];
params.cipher = key->cipher; params.cipher = key->cipher;
params.key_len = key->key_len; params.key_len = key->key_len;
params.seq_len = key->seq_len; params.seq_len = key->seq_len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册