Project

General

Profile

Bug #2544

mpt_sas substract long from int32_t (64Bit)

Added by Peer Dampmann over 8 years ago. Updated over 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
driver - device drivers
Start date:
2012-03-23
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Several occurences where numeric datatypes of different size are substracted from each other

for example:

int32_t-long

static clock_t mptsas_scsi_watchdog_tick; (type long -> sizeof(long) 8 on 64Bit)
m_timeout int32_t

http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c#10051


Related issues

Has duplicate illumos gate - Bug #2448: mpt_sas substract int32_t from long (64Bit)Closed2012-03-23

Actions
#1

Updated by Rich Lowe over 8 years ago

Are you seeing practical problems stemming from this, or was this found by static analysis?

#2

Updated by Peer Dampmann over 8 years ago

It was found by statical analysis. But practical problems will arise when timeouts are not getting handled.

#3

Updated by Rich Lowe over 8 years ago

But only if mptsas_scsi_watchdog_tick has a value which doesn't fit in 32bits, which would be a really nonsensical value for it to have?

#4

Updated by Peer Dampmann over 8 years ago

I don't have enough experience in order to know what kind of values mptsas_scsi_watchdog_tick will take in practice. But in fact it is defined as a long and has the ability to store values bigger than an int32_t. There is a type mismatch and if for some reason someone relies on type long there is a problem, right?

#5

Updated by Peer Dampmann over 8 years ago

I mean it is wrong from a theoretical perspective :-)

Also available in: Atom PDF