From: Greg Kroah-Hartman Date: Wed, 30 Aug 2017 14:39:24 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v3.18.69~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bab9df24959eb5f541318a1dc627c42c3293eb7;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: p54-memset-0-whole-array.patch scsi-isci-avoid-array-subscript-warning.patch staging-wilc1000-simplify-vif-ndev-accesses.patch --- diff --git a/queue-4.9/p54-memset-0-whole-array.patch b/queue-4.9/p54-memset-0-whole-array.patch new file mode 100644 index 00000000000..f535a775f74 --- /dev/null +++ b/queue-4.9/p54-memset-0-whole-array.patch @@ -0,0 +1,37 @@ +From 6f17581788206444cbbcdbc107498f85e9765e3d Mon Sep 17 00:00:00 2001 +From: Jiri Slaby +Date: Fri, 14 Oct 2016 11:23:09 +0200 +Subject: p54: memset(0) whole array + +From: Jiri Slaby + +commit 6f17581788206444cbbcdbc107498f85e9765e3d upstream. + +gcc 7 complains: +drivers/net/wireless/intersil/p54/fwio.c: In function 'p54_scan': +drivers/net/wireless/intersil/p54/fwio.c:491:4: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] + +Fix that by passing the correct size to memset. + +Signed-off-by: Jiri Slaby +Cc: Christian Lamparter +Cc: Kalle Valo +Acked-by: Christian Lamparter +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/intersil/p54/fwio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/intersil/p54/fwio.c ++++ b/drivers/net/wireless/intersil/p54/fwio.c +@@ -488,7 +488,7 @@ int p54_scan(struct p54_common *priv, u1 + + entry += sizeof(__le16); + chan->pa_points_per_curve = 8; +- memset(chan->curve_data, 0, sizeof(*chan->curve_data)); ++ memset(chan->curve_data, 0, sizeof(chan->curve_data)); + memcpy(chan->curve_data, entry, + sizeof(struct p54_pa_curve_data_sample) * + min((u8)8, curve_data->points_per_channel)); diff --git a/queue-4.9/scsi-isci-avoid-array-subscript-warning.patch b/queue-4.9/scsi-isci-avoid-array-subscript-warning.patch new file mode 100644 index 00000000000..95533c69914 --- /dev/null +++ b/queue-4.9/scsi-isci-avoid-array-subscript-warning.patch @@ -0,0 +1,38 @@ +From 5cfa2a3c7342bd0b50716c8bb32ee491af43c785 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Fri, 18 Nov 2016 17:14:01 +0100 +Subject: scsi: isci: avoid array subscript warning + +From: Arnd Bergmann + +commit 5cfa2a3c7342bd0b50716c8bb32ee491af43c785 upstream. + +I'm getting a new warning with gcc-7: + +isci/remote_node_context.c: In function 'sci_remote_node_context_destruct': +isci/remote_node_context.c:69:16: error: array subscript is above array bounds [-Werror=array-bounds] + +This is odd, since we clearly cover all values for enum +scis_sds_remote_node_context_states here. Anyway, checking for an array +overflow can't harm and it makes the warning go away. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/isci/remote_node_context.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/scsi/isci/remote_node_context.c ++++ b/drivers/scsi/isci/remote_node_context.c +@@ -66,6 +66,9 @@ const char *rnc_state_name(enum scis_sds + { + static const char * const strings[] = RNC_STATES; + ++ if (state >= ARRAY_SIZE(strings)) ++ return "UNKNOWN"; ++ + return strings[state]; + } + #undef C diff --git a/queue-4.9/staging-wilc1000-simplify-vif-ndev-accesses.patch b/queue-4.9/staging-wilc1000-simplify-vif-ndev-accesses.patch new file mode 100644 index 00000000000..83b289deed2 --- /dev/null +++ b/queue-4.9/staging-wilc1000-simplify-vif-ndev-accesses.patch @@ -0,0 +1,102 @@ +From 735bb39ca3bed8469b3b3a42d8cc57bdb9fc4dd7 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Wed, 16 Nov 2016 16:07:10 +0100 +Subject: staging: wilc1000: simplify vif[i]->ndev accesses + +From: Arnd Bergmann + +commit 735bb39ca3bed8469b3b3a42d8cc57bdb9fc4dd7 upstream. + +With gcc-7, I got a new warning for this driver: + +wilc1000/linux_wlan.c: In function 'wilc_netdev_cleanup': +wilc1000/linux_wlan.c:1224:15: error: 'vif[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized] +wilc1000/linux_wlan.c:1224:15: error: 'vif[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] + +A closer look at the function reveals that it's more complex than +it needs to be, given that based on how the device is created +we always get + + netdev_priv(vif->ndev) == vif + +Based on this assumption, I found a few other places in the same file +that can be simplified. That code appears to be a relic from times +when the assumption above was not valid. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/wilc1000/linux_wlan.c | 34 +++++++++------------------------- + 1 file changed, 9 insertions(+), 25 deletions(-) + +--- a/drivers/staging/wilc1000/linux_wlan.c ++++ b/drivers/staging/wilc1000/linux_wlan.c +@@ -269,23 +269,12 @@ static struct net_device *get_if_handler + + int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode) + { +- int i = 0; +- int ret = -1; +- struct wilc_vif *vif; +- struct wilc *wilc; +- +- vif = netdev_priv(wilc_netdev); +- wilc = vif->wilc; ++ struct wilc_vif *vif = netdev_priv(wilc_netdev); + +- for (i = 0; i < wilc->vif_num; i++) +- if (wilc->vif[i]->ndev == wilc_netdev) { +- memcpy(wilc->vif[i]->bssid, bssid, 6); +- wilc->vif[i]->mode = mode; +- ret = 0; +- break; +- } ++ memcpy(vif->bssid, bssid, 6); ++ vif->mode = mode; + +- return ret; ++ return 0; + } + + int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) +@@ -1212,16 +1201,11 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, + + void wilc_netdev_cleanup(struct wilc *wilc) + { +- int i = 0; +- struct wilc_vif *vif[NUM_CONCURRENT_IFC]; ++ int i; + +- if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) { ++ if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) + unregister_inetaddr_notifier(&g_dev_notifier); + +- for (i = 0; i < NUM_CONCURRENT_IFC; i++) +- vif[i] = netdev_priv(wilc->vif[i]->ndev); +- } +- + if (wilc && wilc->firmware) { + release_firmware(wilc->firmware); + wilc->firmware = NULL; +@@ -1230,7 +1214,7 @@ void wilc_netdev_cleanup(struct wilc *wi + if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) { + for (i = 0; i < NUM_CONCURRENT_IFC; i++) + if (wilc->vif[i]->ndev) +- if (vif[i]->mac_opened) ++ if (wilc->vif[i]->mac_opened) + wilc_mac_close(wilc->vif[i]->ndev); + + for (i = 0; i < NUM_CONCURRENT_IFC; i++) { +@@ -1278,9 +1262,9 @@ int wilc_netdev_init(struct wilc **wilc, + + vif->idx = wl->vif_num; + vif->wilc = *wilc; ++ vif->ndev = ndev; + wl->vif[i] = vif; +- wl->vif[wl->vif_num]->ndev = ndev; +- wl->vif_num++; ++ wl->vif_num = i; + ndev->netdev_ops = &wilc_netdev_ops; + + {