scsi: bfa: document overflow of io_profile_start_time
io_profile_start_time() gets read using do_gettimeofday() and passed down as a 32-bit value through multiple functions. This will overflow in y2038 or y2106, depending on whether it gets interpreted as unsigned in the end. This changes do_gettimeofday() to ktime_get_real_seconds() and pushes the point at which it overflows to where we actually assign it to the bfa_fcpim_del_itn_stats_s structure, with an appropriate comment. 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>
This commit is contained in:
parent
03d32af33d
commit
aa22a52e18
|
@ -468,7 +468,7 @@ bfa_ioim_profile_start(struct bfa_ioim_s *ioim)
|
|||
}
|
||||
|
||||
bfa_status_t
|
||||
bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time)
|
||||
bfa_fcpim_profile_on(struct bfa_s *bfa, time64_t time)
|
||||
{
|
||||
struct bfa_itnim_s *itnim;
|
||||
struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
|
||||
|
@ -1478,6 +1478,7 @@ bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim,
|
|||
return BFA_STATUS_IOPROFILE_OFF;
|
||||
|
||||
itnim->ioprofile.index = BFA_IOBUCKET_MAX;
|
||||
/* unsigned 32-bit time_t overflow here in y2106 */
|
||||
itnim->ioprofile.io_profile_start_time =
|
||||
bfa_io_profile_start_time(itnim->bfa);
|
||||
itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul;
|
||||
|
|
|
@ -136,7 +136,7 @@ struct bfa_fcpim_s {
|
|||
struct bfa_fcpim_del_itn_stats_s del_itn_stats;
|
||||
bfa_boolean_t ioredirect;
|
||||
bfa_boolean_t io_profile;
|
||||
u32 io_profile_start_time;
|
||||
time64_t io_profile_start_time;
|
||||
bfa_fcpim_profile_t profile_comp;
|
||||
bfa_fcpim_profile_t profile_start;
|
||||
};
|
||||
|
@ -310,7 +310,7 @@ bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa,
|
|||
struct bfa_itnim_iostats_s *stats, u8 lp_tag);
|
||||
void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats,
|
||||
struct bfa_itnim_iostats_s *itnim_stats);
|
||||
bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time);
|
||||
bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, time64_t time);
|
||||
bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa);
|
||||
|
||||
#define bfa_fcpim_ioredirect_enabled(__bfa) \
|
||||
|
|
|
@ -2094,13 +2094,11 @@ bfad_iocmd_fcpim_cfg_profile(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
|
|||
{
|
||||
struct bfa_bsg_fcpim_profile_s *iocmd =
|
||||
(struct bfa_bsg_fcpim_profile_s *)cmd;
|
||||
struct timeval tv;
|
||||
unsigned long flags;
|
||||
|
||||
do_gettimeofday(&tv);
|
||||
spin_lock_irqsave(&bfad->bfad_lock, flags);
|
||||
if (v_cmd == IOCMD_FCPIM_PROFILE_ON)
|
||||
iocmd->status = bfa_fcpim_profile_on(&bfad->bfa, tv.tv_sec);
|
||||
iocmd->status = bfa_fcpim_profile_on(&bfad->bfa, ktime_get_real_seconds());
|
||||
else if (v_cmd == IOCMD_FCPIM_PROFILE_OFF)
|
||||
iocmd->status = bfa_fcpim_profile_off(&bfad->bfa);
|
||||
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
|
||||
|
|
Loading…
Reference in New Issue