Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1341195
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Rasmus Villemoes <linux@rasmusvillemoes.dk> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] sscanf: implement basic character sets |
| Date | Wed, 24 Feb 2016 01:10:03 +0100 |
| Message-ID | <r5vbI-4KX-3@gated-at.bofh.it> (permalink) |
| References | <r5rUt-29C-7@gated-at.bofh.it> <r5tWi-3Ha-17@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=nIs1VQGjS84tfbHsWDDGweASHAAxl6s72quznNzJWTU=; b=cRnziHhBHOZEwgUTnDnV7KKyylCvvfnamWpAJlLltFdw4HlL72Vy6ZxkG7+Q1Z3xZi VK5UJy88riPzI/mXX9i1n4XyubwaN3V0+Guf4v/4IehBtSs+4yprTIC+yiwachTztMSs PJRusZWw4axcnjcKby1YABbk0tuNvIA9i4z3Q= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=nIs1VQGjS84tfbHsWDDGweASHAAxl6s72quznNzJWTU=; b=GQsuDBejJUuCuHyLQlN2XR7JDrOeKMF5x4ZvrTNZi42NfWwqXY1uhU6WfU/sv+1TCG x5B0l+dIz5tJbhMPnwkEUK3sOXFDCfOlCC4VJ9SKLcslKul24AVzThu2XTqeRgS+pQ0y r77saqHHtLjGI13N9xNYIz8508XaX36MXq0n3OQOCGArUiso+wJhVV0lZqxEeNX0ImQM p2ObQ7lX9Ibk7M/J8XsAPuP8jOX0BOItkiH8hz7zL6rsZMAfkkntFmchVJF2A7UMWGxV aQD9qs/ZR16xmkPpNefhk1DR/wmKJgajb2B7ENIEggeZBiAww/UCpCaZQ0iZe9AwqP2s ZBuA== |
| X-Gm-Message-State | AG10YOTczUIiqEiCIPWH4vhzUJ/pNYjSABlrMb814TEDTQ6K9Pshzei1KhxsbcVdjUioIw== |
| X-Received | by 10.28.225.8 with SMTP id y8mr21804629wmg.23.1456272119335; Tue, 23 Feb 2016 16:01:59 -0800 (PST) |
| Organization | D03 |
| X-Hashcash | 1:20:160223:linux-kernel@vger.kernel.org::+jzlsvKjq5GUmUjx:000000000000000000000000000000000103z |
| X-Hashcash | 1:20:160223:keescook@chromium.org::d2z1keXH2DemBhxz:00000000000000000000000000000000000000001gkx |
| X-Hashcash | 1:20:160223:andriy.shevchenko@linux.intel.com::EK62p5gmkGEZ8DvO:00000000000000000000000000007155 |
| X-Hashcash | 1:20:160223:jeyu@redhat.com::PLYURtMwRT3wzWUN:006Rg6 |
| X-Hashcash | 1:20:160223:akpm@linux-foundation.org::Y4ZcpFxMD6tRUvSq:000000000000000000000000000000000000AAdk |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 31 |
| X-Original-Cc | Andrew Morton <akpm@linux-foundation.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Kees Cook <keescook@chromium.org>, linux-kernel@vger.kernel.org |
| X-Original-Date | Wed, 24 Feb 2016 01:01:57 +0100 |
| X-Original-Message-ID | <87fuwj9dsa.fsf@rasmusvillemoes.dk> |
| X-Original-References | <1456259902-31792-1-git-send-email-jeyu@redhat.com> <87bn77gi34.fsf@rasmusvillemoes.dk> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1341195 |
Show key headers only | View raw
On Tue, Feb 23 2016, Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> On that note, it seems that your field width handling is off-by-one.
Sorry about that, it's me who's off-by-one.
Rasmus
> To get rid of the allocation, why not use a small bitmap? Something like
>
> {
> char *s = (char *)va_arg(args, char *);
> DECLARE_BITMAP(map, 256) = {0};
> bool negate = false;
>
> /* a field width is required, and must provide room for at least a '\0' */
> if (field_width <= 0)
> return num;
>
should be
/* a field width is required */
if (field_width < 0)
and
> while (test_bit((u8)*str, map) && --field_width) {
should be field_width--, exactly as in your code.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3] sscanf: implement basic character sets Jessica Yu <jeyu@redhat.com> - 2016-02-23 21:40 +0100
Re: [PATCH v3] sscanf: implement basic character sets Kees Cook <keescook@chromium.org> - 2016-02-23 21:50 +0100
Re: [PATCH v3] sscanf: implement basic character sets Andrew Morton <akpm@linux-foundation.org> - 2016-02-23 23:10 +0100
Re: sscanf: implement basic character sets Jessica Yu <jeyu@redhat.com> - 2016-02-24 06:20 +0100
Re: sscanf: implement basic character sets Andrew Morton <akpm@linux-foundation.org> - 2016-02-24 06:30 +0100
Re: [PATCH v3] sscanf: implement basic character sets Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-23 23:50 +0100
Re: [PATCH v3] sscanf: implement basic character sets Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-02-24 01:10 +0100
Re: sscanf: implement basic character sets Jessica Yu <jeyu@redhat.com> - 2016-02-24 06:50 +0100
csiph-web