mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: linux-kernel@vger.kernel.org,
	Russell Cattelan <cattelan@redhat.com>,
	David Teigland <teigland@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	hch@infradead.org
Subject: Re: [PATCH 14/16] GFS2: The DLM interface module
Date: Thu, 07 Sep 2006 10:01:52 +0100	[thread overview]
Message-ID: <1157619712.3384.1044.camel@quoit.chygwyn.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0609051352110.24010@yvahk01.tjqt.qr>

Hi,

On Tue, 2006-09-05 at 14:05 +0200, Jan Engelhardt wrote:
> >+/* make_strname - convert GFS lock numbers to a string */
> >+
> >+static inline void make_strname(struct lm_lockname *lockname,
> >+				struct gdlm_strname *str)
> >+{
> >+	sprintf(str->name, "%8x%16llx", lockname->ln_type,
> >+		(unsigned long long)lockname->ln_number);
> 
> Is this format specifier safe enough? "%08x%016llx" perhaps?
> 
> Imagine (if this happens at all):
> 
>   ln_type = 1; ln_number = 16;
>   %8x = "1", "%16llx" = "10", giving us "110"
> 
>   ln_type = 17; ln_number = 0;
>   %8x = "11", "%16llx" = "0", giving us "110".
> 
> Whoops, name clash.
> 
In this case the field sizes mean that the numbers are padded with
spaces. Also we "know" that ln_type will always be a single digit at
least with the current implementation.

[lines snipped]
> >+	op->info.owner		= (__u64)(long) fl->fl_owner;
> 
> Can't op->info.owner be a 'struct fowner *'? Is op->info.owner shared over the
> network?
> 
It is shared over the network.

> >+static ssize_t block_show(struct gdlm_ls *ls, char *buf)
> >+{
> >+	ssize_t ret;
> >+	int val = 0;
> >+
> >+	if (test_bit(DFL_BLOCK_LOCKS, &ls->flags))
> >+		val = 1;
> >+	ret = sprintf(buf, "%d\n", val);
> 
> Safe enough - @buf big enough?
> 
Yes, buf is one page in size. However Dave Teigland has sent me a couple
of patches to update these routines to the "best practice" according to
the docs for sysfs.

> >+	if (val == 1)
> >+		set_bit(DFL_BLOCK_LOCKS, &ls->flags);
> >+	else if (val == 0) {
> >+		clear_bit(DFL_BLOCK_LOCKS, &ls->flags);
> >+		gdlm_submit_delayed(ls);
> >+	} else
> >+		ret = -EINVAL;
> 
> Ingo surely wants you to {} it.
> 
I've fixed that now. This email's patches are:

http://www.kernel.org/git/?p=linux/kernel/git/steve/gfs2-2.6.git;a=commitdiff;h=c53921248c79197befa7caa4c17b1af5c077a2c2
http://www.kernel.org/git/?p=linux/kernel/git/steve/gfs2-2.6.git;a=commitdiff;h=3204a6c05588788f7686bc45585185a9a4788430
http://www.kernel.org/git/?p=linux/kernel/git/steve/gfs2-2.6.git;a=commitdiff;h=a1d144c71ddc11d3e9d9f29e92cf037da382a541
http://www.kernel.org/git/?p=linux/kernel/git/steve/gfs2-2.6.git;a=commitdiff;h=62f140c173f2c85e15527eefc6e2fb3c37a97eb1

Steve.



  reply	other threads:[~2006-09-07  8:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-31 13:41 Steven Whitehouse
2006-09-05 12:05 ` Jan Engelhardt
2006-09-07  9:01   ` Steven Whitehouse [this message]
2006-09-07 14:58   ` David Teigland
2006-09-07 16:35     ` Jan Engelhardt
2006-09-08  9:26       ` Steven Whitehouse
  -- strict thread matches above, loose matches on Subject: below --
2006-04-21 16:23 Steven Whitehouse

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=1157619712.3384.1044.camel@quoit.chygwyn.com \
    --to=swhiteho@redhat.com \
    --cc=cattelan@redhat.com \
    --cc=hch@infradead.org \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=teigland@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 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®