Re: [PATCH 2/6] kpartx: fix -Wsign-compare error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2020-07-27 at 14:24 -0500, Benjamin Marzinski wrote:
> Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
> ---
>  kpartx/kpartx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
> index c24ad6d9..653ce0c8 100644
> --- a/kpartx/kpartx.c
> +++ b/kpartx/kpartx.c
> @@ -738,7 +738,7 @@ struct block {
>  /* blknr is always in 512 byte blocks */
>  char *
>  getblock (int fd, unsigned int blknr) {
> -	unsigned int secsz = get_sector_size(fd);
> +	int secsz = get_sector_size(fd);
>  	unsigned int blks_per_sec = secsz / 512;
>  	unsigned int secnr = blknr / blks_per_sec;
>  	unsigned int blk_off = (blknr % blks_per_sec) * 512;

I was wondering why I didn't see this one. Turns out that it occurs
only for 32bit compilations. It looks like sort of an overzealous
compiler warning to me, as it's only about a "!=" comparison that can
hardly produce a wrong or unexpected result.

Btw, not that it would matter much, but the value of he BLKSSZGET ioctl
is actually unsigned.

Anyway, ack.

-- 
Dr. Martin Wilck <mwilck@xxxxxxxx>, Tel. +49 (0)911 74053 2107
SUSE  Software Solutions Germany GmbH
HRB 36809, AG Nürnberg GF: Felix
Imendörffer



--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux