Skip to content

Commit

Permalink
Add some explicit casts; ok pedro@
Browse files Browse the repository at this point in the history
  • Loading branch information
natano committed Mar 27, 2015
1 parent 7c389e0 commit 201ffba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions sys/dev/ata/atascsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ atascsi_disk_vpd_ident(struct scsi_xfer *xs)

pg.hdr.device = T_DIRECT;
pg.hdr.page_code = SI_PG_DEVID;
_lto2b(pg_len, pg.hdr.page_length);
_lto2b((u_int32_t)pg_len, pg.hdr.page_length);
pg_len += sizeof(pg.hdr);

bcopy(&pg, xs->data, MIN(pg_len, xs->datalen));
Expand Down Expand Up @@ -1319,7 +1319,7 @@ atascsi_disk_capacity(struct scsi_xfer *xs)
if (capacity > 0xffffffff)
capacity = 0xffffffff;

_lto4b(capacity, rcd.addr);
_lto4b((u_int32_t)capacity, rcd.addr);
_lto4b(ata_identify_blocksize(&ap->ap_identify), rcd.length);

bcopy(&rcd, xs->data, MIN(sizeof(rcd), xs->datalen));
Expand Down
8 changes: 5 additions & 3 deletions sys/scsi/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
return (EFAULT);
if (screq->datalen > MAXPHYS)
return (EINVAL);
if (screq->timeout > INT_MAX)
return (EINVAL);

xs = scsi_xs_get(link, 0);
if (xs == NULL)
Expand All @@ -121,7 +123,7 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
err = ENOMEM;
goto err;
}
xs->datalen = screq->datalen;
xs->datalen = (int)screq->datalen;
}

if (screq->flags & SCCMD_READ)
Expand All @@ -137,7 +139,7 @@ scsi_ioc_cmd(struct scsi_link *link, scsireq_t *screq)
}

xs->flags |= SCSI_SILENT; /* User is responsible for errors. */
xs->timeout = screq->timeout;
xs->timeout = (int)screq->timeout;
xs->retries = 0; /* user must do the retries *//* ignored */

scsi_xs_sync(xs);
Expand Down Expand Up @@ -243,7 +245,7 @@ scsi_ioc_ata_cmd(struct scsi_link *link, atareq_t *atareq)
err = ENOMEM;
goto err;
}
xs->datalen = atareq->datalen;
xs->datalen = (int)atareq->datalen;
}

if (atareq->flags & ATACMD_READ)
Expand Down
12 changes: 6 additions & 6 deletions sys/scsi/scsiconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,16 +1103,16 @@ scsi_inqmatch(struct scsi_inquiry_data *inqbuf, const void *_base,
if (removable != match->removable)
continue;
priority = 2;
len = strlen(match->vendor);
if (bcmp(inqbuf->vendor, match->vendor, len))
len = (int)strlen(match->vendor);
if (memcmp(inqbuf->vendor, match->vendor, len))
continue;
priority += len;
len = strlen(match->product);
if (bcmp(inqbuf->product, match->product, len))
len = (int)strlen(match->product);
if (memcmp(inqbuf->product, match->product, len))
continue;
priority += len;
len = strlen(match->revision);
if (bcmp(inqbuf->revision, match->revision, len))
len = (int)strlen(match->revision);
if (memcmp(inqbuf->revision, match->revision, len))
continue;
priority += len;

Expand Down

0 comments on commit 201ffba

Please sign in to comment.