[lkml]   [2005]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Use sg_init_one where appropriate
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 @@
> -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.


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


Ingo Oeser

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2005-08-27 14:09    [W:0.083 / U:3.592 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site