Convert the last users of copystr that were not using the length
argument to strlcpy.
Details
- Reviewers
mhorne
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 71894 Build 68777: arc lint + arc unit
Event Timeline
| sys/dev/vmm/vmm_dev.c | ||
|---|---|---|
| 274–277 | Strlcpy returns the number of characters that would be copied if dst is large enought. Not an error | |
Hi, thanks for taking this on, it would be nice to see this conversion completed.
Most important: the order of 'src' and 'dest' is reversed between copystr() and strlcpy(). You have not accounted for this.
Second: there are more instances of copystr() in the tree needing conversion that do not yet appear in this patch.
| sys/dev/vmm/vmm_dev.c | ||
|---|---|---|
| 274–277 | Clever, but not quite right. In this case, error is propagated upwards, and eventually returned to userspace. We need to take care to set a real error code, not a boolean value. You can see that copystr() is defined as a macro (in sys/systm.h) as a wrapper for strlcpy(). So in each of these instances the goal is likely to de-inline that macro, returning ENAMETOOLONG wherever it does now. Similar advice applies below. | |
Yeez, that was a bad shot from the hip. Sorry about that.
Give me some time and I do the complete thing with those cases that do use the length return argument, too,. Just not late at night.
It's worse. copystr and strlcpy also have a different
idea of what string length means. Taken into account now.