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
- Follow-Ups:
- Re: [PATCH] Use sg_init_one where appropriate
- From: David Härdeman <[email protected]>
- Re: [PATCH] Use sg_init_one where appropriate
- References:
- [PATCH] Use sg_init_one where appropriate
- From: David Härdeman <[email protected]>
- [PATCH] Use sg_init_one where appropriate
- Prev by Date: [PATCH] zfcp: add rports to enable scsi_add_device to work again
- Next by Date: Linux 2.6 context switching and posix threads performance question
- Previous by thread: [PATCH] Use sg_init_one where appropriate
- Next by thread: Re: [PATCH] Use sg_init_one where appropriate
- Index(es):