mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Oeser <ioe-lkml@rameria.de>
To: "David Härdeman" <david@2gen.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Use sg_init_one where appropriate
Date: Sat, 27 Aug 2005 14:06:26 +0200	[thread overview]
Message-ID: <200508271406.32111.ioe-lkml@rameria.de> (raw)
In-Reply-To: <20050827003340.GB9222@hansolo>

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

Hi David,

I appreciate your work on unifying common code, but have some comments.

On Saturday 27 August 2005 02:33, David Härdeman wrote:
> The same code as in sg_init_one can be found in a number of places, this 
> patch changes them to call the function instead.
> Index: linux-sginitone/include/linux/scatterlist.h
> ===================================================================
> --- linux-sginitone.orig/include/linux/scatterlist.h	2005-03-02 08:38:32.000000000 +0100
> +++ linux-sginitone/include/linux/scatterlist.h	2005-08-27 00:20:53.000000000 +0200
> @@ -1,8 +1,9 @@
>  #ifndef _LINUX_SCATTERLIST_H
>  #define _LINUX_SCATTERLIST_H
>  
> -static inline void sg_init_one(struct scatterlist *sg,
> -			       u8 *buf, unsigned int buflen)
> +static inline void sg_init_one(const struct scatterlist *sg,
> +			       const u8 *buf,
> +			       const unsigned int buflen)
>  {
>  	memset(sg, 0, sizeof(*sg));
>  

In short: please remove all "const" markers from the function, 
	try to uninline it somewhere and resend.

Explanation:

If this compiles without any warning, then your compiler is clearly broken.

You promise to not modify the memory pointed to by "sg" and set it
to zero then?

You also assign buflen to a variable, which voids the "const" attribute
anyway. For "buf" this is also wrong. The memory pointed to it
will be assigned to a variable whose modification you cannot control.

And while you are at it, please check, wether this can be uninlined,
since it does a lot of things and is called from quite some sites
then.


Regards

Ingo Oeser



[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-08-27 12:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-27  0:33 David Härdeman
2005-08-27 12:06 ` Ingo Oeser [this message]
2005-08-27 18:49   ` David Härdeman

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=200508271406.32111.ioe-lkml@rameria.de \
    --to=ioe-lkml@rameria.de \
    --cc=david@2gen.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®