Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1637923
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] pinctrl: imx: Check for memory allocation failure |
| Date | 2017-05-09 09:30 +0200 |
| Message-ID | <tF7KN-6Yd-3@gated-at.bofh.it> (permalink) |
| References | <tE3gd-5Fp-3@gated-at.bofh.it> <tEdSh-3MB-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, May 07, 2017 at 04:40:38AM +0900, Stafford Horne wrote: > Hi Christophe, > > On Sat, May 06, 2017 at 10:23:59AM +0200, Christophe JAILLET wrote: > > If 'devm_kzalloc' fails, a NULL pointer will be dereferenced. > > Return -ENOMEM instead, as done for the other memory allocation just a > > few lines below. > > This looks fine. > > > BTW, change the 'devm_kzalloc' into a 'devm_kcalloc'. > > Any reason for the devm_kcalloc change? It looks like the next for loop > does set all of the group_name values. > The advantage of kcalloc() over kzalloc() is the integer overflow checking. There is kmalloc_array() if we don't need to zero the memory. regards, dan carpenter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] pinctrl: imx: Check for memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-05-06 10:30 +0200
Re: [PATCH] pinctrl: imx: Check for memory allocation failure Stafford Horne <shorne@gmail.com> - 2017-05-06 21:50 +0200
Re: [PATCH] pinctrl: imx: Check for memory allocation failure Dan Carpenter <dan.carpenter@oracle.com> - 2017-05-09 09:30 +0200
Re: [PATCH] pinctrl: imx: Check for memory allocation failure Stafford Horne <shorne@gmail.com> - 2017-05-09 14:40 +0200
csiph-web