mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH trivial] Fix the comparison with sizeof()
@ 2006-02-14 20:02 Takashi Iwai
  2006-02-15  5:54 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2006-02-14 20:02 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Fix the comparison with sizeof() in min() macro.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 7139659..6be4fb3 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1597,13 +1597,13 @@ int aac_scsi_cmd(struct scsi_cmnd * scsi
 		cp[11] = 0;
 		cp[12] = 0;
 		aac_internal_transfer(scsicmd, cp, 0,
-		  min((unsigned int)scsicmd->cmnd[13], sizeof(cp)));
+		  min((size_t)scsicmd->cmnd[13], sizeof(cp)));
 		if (sizeof(cp) < scsicmd->cmnd[13]) {
 			unsigned int len, offset = sizeof(cp);
 
 			memset(cp, 0, offset);
 			do {
-				len = min(scsicmd->cmnd[13]-offset, sizeof(cp));
+				len = min((size_t)(scsicmd->cmnd[13]-offset), sizeof(cp));
 				aac_internal_transfer(scsicmd, cp, offset, len);
 			} while ((offset += len) < scsicmd->cmnd[13]);
 		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH trivial] Fix the comparison with sizeof()
  2006-02-14 20:02 [PATCH trivial] Fix the comparison with sizeof() Takashi Iwai
@ 2006-02-15  5:54 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2006-02-15  5:54 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel

Takashi Iwai <tiwai@suse.de> wrote:
>
>  -		  min((unsigned int)scsicmd->cmnd[13], sizeof(cp)));
>  +		  min((size_t)scsicmd->cmnd[13], sizeof(cp)));

Note that this can also be done with the min_t() macro, although I can't
immediately think of a reason why min_t() is any better..

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-15  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-14 20:02 [PATCH trivial] Fix the comparison with sizeof() Takashi Iwai
2006-02-15  5:54 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®