All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: lvm-devel@redhat.com
Subject: Re: [PATCH 2/6] Add devices/data_alignment_offset_detection to lvm.conf.
Date: Thu, 16 Jul 2009 17:15:57 -0400	[thread overview]
Message-ID: <20090716211557.GA9913@redhat.com> (raw)
In-Reply-To: <4A5F75CC.8060203@redhat.com>

On Thu, Jul 16 2009 at  2:47pm -0400,
Milan Broz <mbroz@redhat.com> wrote:

> Mike Snitzer wrote:
> > +	if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/%s",
> > +			sysfs_dir, MAJOR(dev->dev), MINOR(dev->dev),
> > +			attribute) < 0) {
> > +		log_error("dm_snprintf %s failed", attribute);
> > +		return 0;
> > +	}
> >
> >   
> this segfaults here on 32bit...
>
> ---
>  lib/device/device.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/device/device.c b/lib/device/device.c
> index 2d01ec8..5330e3c 100644
> --- a/lib/device/device.c
> +++ b/lib/device/device.c
> @@ -296,7 +296,7 @@ int primary_dev(const char *sysfs_dir,
>  
>  	/* check if dev is a partition */
>  	if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/partition",
> -			sysfs_dir, MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
> +			sysfs_dir, (int)MAJOR(dev->dev), (int)MINOR(dev->dev)) < 0) {
>  		log_error("dm_snprintf partition failed");
>  		return ret;
>  	}
> @@ -366,7 +366,7 @@ static unsigned long _dev_topology_attribute(const char *attribute,
>  		return_0;
>  
>  	if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir,
> -			MAJOR(dev->dev), MINOR(dev->dev),
> +			(int)MAJOR(dev->dev), (int)MINOR(dev->dev),
>  			attribute) < 0) {
>  		log_error("dm_snprintf %s failed", attribute);
>  		return 0;
> 
> 


BTW, Peter was seeing dm_snprintf() segfaults with my patches too.

I'll be sure to cast all MAJOR() and MINOR() calls when used with
dm_snprintf().  Would still like to understand how not using a cast gets
us into trouble... but that is for when I get back from vacation ;)

Mike



  parent reply	other threads:[~2009-07-16 21:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 20:11 [PATCH 0/6 v5] LVM2 topology support Mike Snitzer
2009-07-13 20:11 ` [PATCH 1/6] Add --dataalignmentoffset to pvcreate to pad aligned data area Mike Snitzer
2009-07-16 15:11   ` Alasdair G Kergon
2009-07-16 20:53     ` Mike Snitzer
2009-07-16 22:11       ` Alasdair G Kergon
2009-07-13 20:11 ` [PATCH 2/6] Add devices/data_alignment_offset_detection to lvm.conf Mike Snitzer
2009-07-16 18:47   ` Milan Broz
2009-07-16 21:00     ` Mike Snitzer
2009-07-16 21:15     ` Mike Snitzer [this message]
2009-07-17  7:43       ` Milan Broz
2009-07-13 20:11 ` [PATCH 3/6] Add devices/data_alignment_detection " Mike Snitzer
2009-07-13 20:11 ` [PATCH 4/6] Improve ability to lookup primary device associated with partition Mike Snitzer
2009-07-13 20:11 ` [PATCH 5/6] Retrieve MD sysfs attributes for MD partitions Mike Snitzer
2009-07-13 20:11 ` [PATCH 6/6] Add MD, partition and topology tests to the LVM2 test-suite Mike Snitzer
  -- strict thread matches above, loose matches on Subject: below --
2009-07-23  2:53 [PATCH 0/6 v6] LVM2 topology support Mike Snitzer
2009-07-23  2:53 ` [PATCH 2/6] Add devices/data_alignment_offset_detection to lvm.conf Mike Snitzer
2009-07-25 22:14 [PATCH 0/6 v7] LVM2 topology support Mike Snitzer
2009-07-25 22:14 ` [PATCH 2/6] Add devices/data_alignment_offset_detection to lvm.conf Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090716211557.GA9913@redhat.com \
    --to=snitzer@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.