@@ -2212,6 +2212,7 @@ static void handle_timestamp(struct octeon_device *oct,
netif_info(lio, tx_done, lio->netdev,
"Got resulting SKBTX_HW_TSTAMP skb=%p ns=%016llu\n",
skb, (unsigned long long)ns);
+ memset(&ts, 0, sizeof(ts));
ts.hwtstamp = ns_to_ktime(ns + lio->ptp_adjust);
skb_tstamp_tx(skb, &ts);
}
@@ -1340,6 +1340,7 @@ static void handle_timestamp(struct octeon_device *oct, u32 status, void *buf)
netif_info(lio, tx_done, lio->netdev,
"Got resulting SKBTX_HW_TSTAMP skb=%p ns=%016llu\n",
skb, (unsigned long long)ns);
+ memset(&ts, 0, sizeof(ts));
ts.hwtstamp = ns_to_ktime(ns + lio->ptp_adjust);
skb_tstamp_tx(skb, &ts);
}
@@ -109,6 +109,7 @@ void cxgb4_ptp_read_hwstamp(struct adapter *adapter, struct port_info *pi)
tx_ts |= (u64)t4_read_reg(adapter,
T5_PORT_REG(pi->port_id,
MAC_PORT_TX_TS_VAL_HI)) << 32;
+ memset(skb_ts, 0, sizeof(*skb_ts));
skb_ts->hwtstamp = ns_to_ktime(tx_ts);
skb_tstamp_tx(adapter->ptp_tx_skb, skb_ts);
dev_kfree_skb_any(adapter->ptp_tx_skb);
@@ -103,6 +103,7 @@ void hclge_ptp_clean_tx_hwts(struct hclge_dev *hdev)
hdev->ptp->tx_cleaned++;
ns += (((u64)hi) << 32 | lo) * NSEC_PER_SEC;
+ memset(&hwts, 0, sizeof(hwts));
hwts.hwtstamp = ns_to_ktime(ns);
skb_tstamp_tx(skb, &hwts);
dev_kfree_skb_any(skb);
@@ -445,6 +445,7 @@ static void mlxsw_sp1_packet_timestamp(struct mlxsw_sp *mlxsw_sp,
nsec = timecounter_cyc2time(&mlxsw_sp->clock->tc, timestamp);
spin_unlock_bh(&mlxsw_sp->clock->lock);
+ memset(&hwtstamps, 0, sizeof(hwtstamps));
hwtstamps.hwtstamp = ns_to_ktime(nsec);
mlxsw_sp1_ptp_packet_finish(mlxsw_sp, skb,
key.local_port, key.ingress, &hwtstamps);
@@ -170,6 +170,7 @@ void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
tx_queue->completed_timestamp_minor)) {
struct skb_shared_hwtstamps hwtstamp;
+ memset(&hwtstamp, 0, sizeof(hwtstamp));
hwtstamp.hwtstamp =
efx_ptp_nic_to_kernel_time(tx_queue);
skb_tstamp_tx(skb, &hwtstamp);
@@ -659,6 +659,7 @@ static void ines_txtstamp_work(struct work_struct *work)
kfree_skb(skb);
return;
}
+ memset(&ssh, 0, sizeof(ssh));
ssh.hwtstamp = ns_to_ktime(ns);
skb_complete_tx_timestamp(skb, &ssh);
}
There are only a few locations, which do not initialize the whole skb_shared_hwtstamps structure and write the only field of the structure. This is ok as long as skb_shared_hwtstamps is not extended with additional fields. Always initialize the whole skb_shared_hwtstamps structure to prepare for future extensions of this structure. Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> --- drivers/net/ethernet/cavium/liquidio/lio_main.c | 1 + drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 1 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c | 1 + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.c | 1 + drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 1 + drivers/net/ethernet/sfc/tx_common.c | 1 + drivers/ptp/ptp_ines.c | 1 + 7 files changed, 7 insertions(+)