Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: bfa: improve bfa_ioc_send_enable/disable data

In bfa_ioc_send_enable, we use the deprecated do_gettimeofday() function
to read the current time. This is not a problem, since the firmware
interface is already limited to 32-bit timestamps, but it's better to
use ktime_get_seconds() and document what the limitation is.

I noticed that I did the same change in commit a5af83925363 ("bna: avoid
writing uninitialized data into hw registers") for the ethernet
driver. That commit also changed the "disable" funtion to initialize the
data we pass to the firmware properly, so I'm doing the same thing here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Anil Gurumurthy <Anil.Gurumurthy@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Arnd Bergmann and committed by
Martin K. Petersen
03d32af3 8f604a03

+5 -3
+5 -3
drivers/scsi/bfa/bfa_ioc.c
··· 1809 1809 bfa_ioc_send_enable(struct bfa_ioc_s *ioc) 1810 1810 { 1811 1811 struct bfi_ioc_ctrl_req_s enable_req; 1812 - struct timeval tv; 1813 1812 1814 1813 bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, 1815 1814 bfa_ioc_portid(ioc)); 1816 1815 enable_req.clscode = cpu_to_be16(ioc->clscode); 1817 - do_gettimeofday(&tv); 1818 - enable_req.tv_sec = be32_to_cpu(tv.tv_sec); 1816 + /* unsigned 32-bit time_t overflow in y2106 */ 1817 + enable_req.tv_sec = be32_to_cpu(ktime_get_real_seconds()); 1819 1818 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); 1820 1819 } 1821 1820 ··· 1825 1826 1826 1827 bfi_h2i_set(disable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_DISABLE_REQ, 1827 1828 bfa_ioc_portid(ioc)); 1829 + disable_req.clscode = cpu_to_be16(ioc->clscode); 1830 + /* unsigned 32-bit time_t overflow in y2106 */ 1831 + disable_req.tv_sec = be32_to_cpu(ktime_get_real_seconds()); 1828 1832 bfa_ioc_mbox_send(ioc, &disable_req, sizeof(struct bfi_ioc_ctrl_req_s)); 1829 1833 } 1830 1834