Re: [PATCH] Use sg_init_one where appropriate

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

 



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: pgpmoW0ZtOyAl.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux