stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] nvmem: brcm_nvram: check for allocation failure
@ 2022-05-10  9:35 Srinivas Kandagatla
  2022-05-19 16:56 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Kandagatla @ 2022-05-10  9:35 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, Dan Carpenter, stable, Rafał Miłecki,
	Srinivas Kandagatla

From: Dan Carpenter <dan.carpenter@oracle.com>

Check for if the kcalloc() fails.

Cc: stable@vger.kernel.org
Fixes: 299dc152721f ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
Hi Greg,

This is the only patch that was not applied cleanly to char-misc-testing due
some fixes that are already applied on the same file.
Rebased this and resending just this one.

Thanks,
--srini


 drivers/nvmem/brcm_nvram.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c
index 450b927691c3..48bb8c62cbbf 100644
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -97,6 +97,8 @@ static int brcm_nvram_parse(struct brcm_nvram *priv)
 	len = le32_to_cpu(header.len);
 
 	data = kcalloc(1, len, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
 	memcpy_fromio(data, priv->base, len);
 	data[len - 1] = '\0';
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] nvmem: brcm_nvram: check for allocation failure
  2022-05-10  9:35 [PATCH v2] nvmem: brcm_nvram: check for allocation failure Srinivas Kandagatla
@ 2022-05-19 16:56 ` Greg KH
  2022-05-19 17:03   ` Srinivas Kandagatla
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-05-19 16:56 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: linux-kernel, Dan Carpenter, stable, Rafał Miłecki

On Tue, May 10, 2022 at 10:35:40AM +0100, Srinivas Kandagatla wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Check for if the kcalloc() fails.
> 
> Cc: stable@vger.kernel.org
> Fixes: 299dc152721f ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")

This isn't a commit in any tree that I can see, are you sure it is
correct?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] nvmem: brcm_nvram: check for allocation failure
  2022-05-19 16:56 ` Greg KH
@ 2022-05-19 17:03   ` Srinivas Kandagatla
  2022-05-20  6:50     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Kandagatla @ 2022-05-19 17:03 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, Dan Carpenter, stable, Rafał Miłecki



On 19/05/2022 17:56, Greg KH wrote:
> On Tue, May 10, 2022 at 10:35:40AM +0100, Srinivas Kandagatla wrote:
>> From: Dan Carpenter <dan.carpenter@oracle.com>
>>
>> Check for if the kcalloc() fails.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 299dc152721f ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
> 
> This isn't a commit in any tree that I can see, are you sure it is
> correct?
Looks like the commit is not correct,
It should be

Fixes: 6e977eaa8280 ("nvmem: brcm_nvram: parse NVRAM content into NVMEM 
cells")


Dan, can you send this with fix to Fixes tag?

--srini


> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] nvmem: brcm_nvram: check for allocation failure
  2022-05-19 17:03   ` Srinivas Kandagatla
@ 2022-05-20  6:50     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-05-20  6:50 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Greg KH, linux-kernel, stable, Rafał Miłecki

On Thu, May 19, 2022 at 06:03:56PM +0100, Srinivas Kandagatla wrote:
> 
> 
> On 19/05/2022 17:56, Greg KH wrote:
> > On Tue, May 10, 2022 at 10:35:40AM +0100, Srinivas Kandagatla wrote:
> > > From: Dan Carpenter <dan.carpenter@oracle.com>
> > > 
> > > Check for if the kcalloc() fails.
> > > 
> > > Cc: stable@vger.kernel.org
> > > Fixes: 299dc152721f ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells")
> > 
> > This isn't a commit in any tree that I can see, are you sure it is
> > correct?
> Looks like the commit is not correct,
> It should be
> 
> Fixes: 6e977eaa8280 ("nvmem: brcm_nvram: parse NVRAM content into NVMEM
> cells")
> 
> 
> Dan, can you send this with fix to Fixes tag?

No problem.  Done.

The problem is that Fixes tags will change if you use email instead of
git pulls.  Or maybe someone used git and did a rebase?  The point is if
you just use git everywhere and don't rebase then the hashes are
immutable.

No stress though, we figured it out.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-20  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  9:35 [PATCH v2] nvmem: brcm_nvram: check for allocation failure Srinivas Kandagatla
2022-05-19 16:56 ` Greg KH
2022-05-19 17:03   ` Srinivas Kandagatla
2022-05-20  6:50     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).