Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1471706
| Path | csiph.com!news.redatomik.org!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions |
| Date | Mon, 29 Aug 2016 12:40:02 +0200 |
| Message-ID | <sbs8W-69R-15@gated-at.bofh.it> (permalink) |
| References | <s9YcW-6Yd-11@gated-at.bofh.it> <s9YcW-6Yd-9@gated-at.bofh.it> <sbrmx-5BR-7@gated-at.bofh.it> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V03:K0:2piQcVoAHtnT/C406XGRmkxXcAcClWm0dKNiR6iK11SxpPAdW2p gjq7BYiwV77kTgt/JOtabN1d4e8FXpgooOANc16DVeLLHp11WmwqXhbyqnQldLooM5z8WHC Jrb4OTAkuLqRApv8G9aJM/r+KHjYjBMMpkT5VhJ2C0CvpNslxjvN3h8N+xVwKMbAzTKX1KG ntTA6MjEN8eQ6yb81cLvQ== |
| X-Ui-Out-Filterresults | notjunk:1;V01:K0:vlrpzXQ49Oo=:z4deiKu9gqc05ghQwYvtI4 GnyP7vp9WFvRW7KBqo6rN6jt//p+vcVkWf18e3G5xvvTUfHlNvmWQUlSUbZDzLr7IgEjr9UFV Y44IgUUoB6XOSciqNhZOgW4ZlYPbBxLo935Gc6DaIpGNARgjaYGRytX3o/Icq5LfH6Ct7/wqc MBviPq/SEb95fGn8Pl7h6Xg9cO0zZgpQgxluwJ7uF4plQybaBox0r6iN3s2KzzFpEk11T6Mss dcylZWlmCu1jdvi35cJLbFDyp+tu9G+r3J9ndr/f5JKZiE5MyaaejyOzOfwEUJzFzVtHbsCEJ KTkzsKlnOpq/tLm4f5surjzgA0JrqrHwTSqTmb0fmNxFAZq3XqHbPDrOBeUxwkKZe4z2pOfqD GweFeMwk3FEJQkUoen/0yIGzacroFFRfk181CyxBskFwK6wbQ63eqcwIvKIKQlC8FcvMUy/Pb dZI0ckhFDqDu1unVHkxdruEPcLWSSsrspyHj91OWoPA1y1xv0mqVXUwb5kCArjCu48aL3KXWY ZHk3YhzL5AUUWdPG192QS+lmiWVeG+pUm+4nd923Gx64T+mGIeyeMGWIAj7CoP28kqQ5KYpKG T5ovbSsvAViULoSyUmNpGw/Qhm//xowY5HViReA/QWUfZTVO56uwRHz7/TBkf4J/jqTmNlQeY qD7+5rsJgVM5hwHP6Kjmur5TNL25XqxbX/+s2mgT9xqLVRWMITprZwOXFKy/TtFJ0NM+AgG3r cpCXKa1n5eAE1SLY1pBq+N0FQD10UywzWsXi9tDK8EVChij5xnvoLUbNVCi4kn2aGkAI0yyP9 z1nqsiT |
| 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 | 18 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | sparclinux@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr> |
| X-Original-Date | Mon, 29 Aug 2016 12:36:24 +0200 |
| X-Original-Message-ID | <248bd932-3f3f-3eb5-d313-ef6f6e71ab49@users.sourceforge.net> |
| X-Original-References | <0ca0235c-ddb9-0534-3bde-b4aaa48da92e@users.sourceforge.net> <fbdf6d83-08ac-a6b2-1674-53bc86c69ae8@users.sourceforge.net> <4475e65d-415d-9cde-1fe1-c17e120849c4@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1471706 |
Show key headers only | View raw
>> @@ -69,7 +69,7 @@ static ssize_t led_proc_write(struct file *file, const char __user *buffer, >> if (count > LED_MAX_LENGTH) >> count = LED_MAX_LENGTH; >> >> - buf = kmalloc(sizeof(char) * (count + 1), GFP_KERNEL); >> + buf = kmalloc_array(count + 1, sizeof(*buf), GFP_KERNEL); >> if (!buf) >> return -ENOMEM; >> > > Here it's probably best to just remove sizeof(char) completely, > as it's 1 by definition. Would you like to be prepared anyhow that the shown buffer variable could eventually store other data than ordinary single byte characters? Regards, Markus
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions Paolo Bonzini <pbonzini@redhat.com> - 2016-08-29 11:50 +0200
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-29 12:40 +0200
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions walter harms <wharms@bfs.de> - 2016-08-29 14:00 +0200
Re: [PATCH 1/2] sparc: Use kmalloc_array() in three functions Paolo Bonzini <pbonzini@redhat.com> - 2016-08-29 18:50 +0200
csiph-web