* [PATCH 0/3] Use string bound functions (take #2)
@ 2007-01-29 14:22 Christoph Egger
2007-01-29 16:07 ` Keir Fraser
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Egger @ 2007-01-29 14:22 UTC (permalink / raw)
To: xen-devel
Hi!
I killed safe_strcpy() and almost all users from strcpy() and strncpy().
The remaining users are acm and acpi.
When this is done, strcpy() and strncpy() can be removed.
patch 1/3:
Changes arch-independent code.
Warning: Since tools re-uses libelf, this breaks the tool-building of the
Linux distris, whose glibc have NO strlcpy/strlcat.
Solaris and *BSD are fine. They have these functions.
Keir, it's up to you if you apply this or if you wait until a fix for the
tools is available.
patch 2/3:
Changes for x86 platform.
patch 3/3:
Changes for ppc/ia64 platforms.
Warning: Due to lack of hw, these two patches are NOT even compile-tested.
IA64 and PPC maintainers, please verify.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Use string bound functions (take #2)
2007-01-29 14:22 [PATCH 0/3] Use string bound functions (take #2) Christoph Egger
@ 2007-01-29 16:07 ` Keir Fraser
2007-01-29 16:22 ` Stefan Berger
2007-01-30 8:23 ` Christoph Egger
0 siblings, 2 replies; 6+ messages in thread
From: Keir Fraser @ 2007-01-29 16:07 UTC (permalink / raw)
To: Christoph Egger, xen-devel
On 29/1/07 14:22, "Christoph Egger" <Christoph.Egger@amd.com> wrote:
> I killed safe_strcpy() and almost all users from strcpy() and strncpy().
> The remaining users are acm and acpi.
> When this is done, strcpy() and strncpy() can be removed.
Okay, there are no live users of strcpy/strncpy/strcat/strncat (I fixed the
acm uses and the acpi uses are dead macros that aren't used). So I've killed
off those functions, #defined them to informative undefined labels, and
implemented strlcat().
sprintf() can go once the ia64 uses are fixed up.
-- Keir
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Use string bound functions (take #2)
2007-01-29 16:07 ` Keir Fraser
@ 2007-01-29 16:22 ` Stefan Berger
2007-01-29 16:35 ` Keir Fraser
2007-01-30 8:23 ` Christoph Egger
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Berger @ 2007-01-29 16:22 UTC (permalink / raw)
To: Keir Fraser; +Cc: Christoph Egger, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2163 bytes --]
xen-devel-bounces@lists.xensource.com wrote on 01/29/2007 11:07:18 AM:
> On 29/1/07 14:22, "Christoph Egger" <Christoph.Egger@amd.com> wrote:
>
> > I killed safe_strcpy() and almost all users from strcpy() and
strncpy().
> > The remaining users are acm and acpi.
Thanks. This would have been it -- I am sure you did the same.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Index: root/xen-unstable.hg/xen/acm/acm_core.c
===================================================================
--- root.orig/xen-unstable.hg/xen/acm/acm_core.c
+++ root/xen-unstable.hg/xen/acm/acm_core.c
@@ -89,7 +89,9 @@ acm_set_policy_reference(u8 * buf, u32 b
if (!acm_bin_pol.policy_reference_name)
return -ENOMEM;
- strcpy(acm_bin_pol.policy_reference_name, (char *)(buf +
sizeof(struct acm_policy_reference_buffer)));
+ strlcpy(acm_bin_pol.policy_reference_name,
+ (char *)(buf + sizeof(struct acm_policy_reference_buffer)),
+ ntohl(pr->len));
printk("%s: Activating policy %s\n", __func__,
acm_bin_pol.policy_reference_name);
return 0;
}
@@ -106,8 +108,9 @@ acm_dump_policy_reference(u8 *buf, u32 b
memset(buf, 0, ret);
pr_buf->len = htonl(strlen(acm_bin_pol.policy_reference_name) + 1);
/* including stringend '\0' */
- strcpy((char *)(buf + sizeof(struct acm_policy_reference_buffer)),
- acm_bin_pol.policy_reference_name);
+ strlcpy((char *)(buf + sizeof(struct acm_policy_reference_buffer)),
+ acm_bin_pol.policy_reference_name,
+ buf_size - sizeof(struct acm_policy_reference_buffer));
return ret;
}
> > When this is done, strcpy() and strncpy() can be removed.
>
> Okay, there are no live users of strcpy/strncpy/strcat/strncat (I fixed
the
> acm uses and the acpi uses are dead macros that aren't used). So I've
killed
> off those functions, #defined them to informative undefined labels, and
> implemented strlcat().
>
> sprintf() can go once the ia64 uses are fixed up.
>
> -- Keir
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 2920 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Use string bound functions (take #2)
2007-01-29 16:22 ` Stefan Berger
@ 2007-01-29 16:35 ` Keir Fraser
0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2007-01-29 16:35 UTC (permalink / raw)
To: Stefan Berger, Keir Fraser; +Cc: Christoph Egger, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 671 bytes --]
On 29/1/07 16:22, "Stefan Berger" <stefanb@us.ibm.com> wrote:
>> > On 29/1/07 14:22, "Christoph Egger" <Christoph.Egger@amd.com> wrote:
>> >
>>> > > I killed safe_strcpy() and almost all users from strcpy() and strncpy().
>>> > > The remaining users are acm and acpi.
>
> Thanks. This would have been it -- I am sure you did the same.
>
> Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Same for the first one. A bit different for the second one (but I¹m sure
it¹s okay either way: there¹s already a test against buf_size earlier in
that function). I¹d appreciate it if you glance an eye over it when it hits
the public tree later on.
-- Keir
[-- Attachment #1.2: Type: text/html, Size: 1485 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Use string bound functions (take #2)
2007-01-29 16:07 ` Keir Fraser
2007-01-29 16:22 ` Stefan Berger
@ 2007-01-30 8:23 ` Christoph Egger
2007-01-30 9:24 ` Keir Fraser
1 sibling, 1 reply; 6+ messages in thread
From: Christoph Egger @ 2007-01-30 8:23 UTC (permalink / raw)
To: xen-devel; +Cc: Keir Fraser
On Monday 29 January 2007 17:07, Keir Fraser wrote:
> On 29/1/07 14:22, "Christoph Egger" <Christoph.Egger@amd.com> wrote:
> > I killed safe_strcpy() and almost all users from strcpy() and strncpy().
> > The remaining users are acm and acpi.
> > When this is done, strcpy() and strncpy() can be removed.
>
> Okay, there are no live users of strcpy/strncpy/strcat/strncat (I fixed the
> acm uses and the acpi uses are dead macros that aren't used). So I've
> killed off those functions, #defined them to informative undefined labels,
> and implemented strlcat().
>
> sprintf() can go once the ia64 uses are fixed up.
Great! When do these changes appear in the public tree?
Christoph
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Use string bound functions (take #2)
2007-01-30 8:23 ` Christoph Egger
@ 2007-01-30 9:24 ` Keir Fraser
0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2007-01-30 9:24 UTC (permalink / raw)
To: Christoph Egger, xen-devel; +Cc: Keir Fraser
On 30/1/07 08:23, "Christoph Egger" <Christoph.Egger@amd.com> wrote:
>> Okay, there are no live users of strcpy/strncpy/strcat/strncat (I fixed the
>> acm uses and the acpi uses are dead macros that aren't used). So I've
>> killed off those functions, #defined them to informative undefined labels,
>> and implemented strlcat().
>>
>> sprintf() can go once the ia64 uses are fixed up.
>
> Great! When do these changes appear in the public tree?
Some are already in. The rest should push today; hopefully regression tests
will pass and the tree will get pushed automatically.
-- Keir
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-01-30 9:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-29 14:22 [PATCH 0/3] Use string bound functions (take #2) Christoph Egger
2007-01-29 16:07 ` Keir Fraser
2007-01-29 16:22 ` Stefan Berger
2007-01-29 16:35 ` Keir Fraser
2007-01-30 8:23 ` Christoph Egger
2007-01-30 9:24 ` Keir Fraser
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.