Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1490712
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] add u64 number parser |
| Date | 2016-09-24 20:40 +0200 |
| Message-ID | <sl01H-4uy-5@gated-at.bofh.it> (permalink) |
| References | <skXdv-2Iz-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Sep 24, 2016 at 8:27 AM, James Smart <james.smart@broadcom.com> wrote:
>
> add u64 number parser
>
> Prior patch revised to use kasprintf.
> Modified match_number to use kasprintf as well
Why would you do this? It's insane. kasprintf() is not the right thing
at all to use for anything like this. It appears that you want to use
strncpy() or something. Or you could just avoid the extra copy
entirely in 99% of all cases and just use simple_strtol() and check
that the end didn't overflow the substring, which it presumably never
does anyway.
Yes, the stupid code is already disgustingly bad. But let's not make
it *worse*, for chrissake!
Linus
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3] add u64 number parser james.smart@broadcom.com (James Smart) - 2016-09-24 17:40 +0200 Re: [PATCH v3] add u64 number parser Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-24 20:40 +0200
csiph-web