You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pkarashchenko (via GitHub)" <gi...@apache.org> on 2023/06/26 15:01:55 UTC
[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #9621: all: fix null pointer dereference
pkarashchenko commented on code in PR #9621:
URL: https://github.com/apache/nuttx/pull/9621#discussion_r1242341403
##########
arch/arm/src/cxd56xx/cxd56_dmac.c:
##########
@@ -442,6 +447,11 @@ static int intr_handler_admac1(int irq, void *context, void *arg)
static int intr_handler_idmac(int irq, void *context, void *arg)
{
struct dmac_register_map *dev = get_device(2); /* XXX */
+ if (dev == NULL)
+ {
+ return -ENODEV;
+ }
+
uint32_t stat = dev->intstatus & 0x1f;
int i;
Review Comment:
Despite the platform specific code can use any C standard I would recommend to change the solution with the respect to style used in other places
```suggestion
struct dmac_register_map *dev = get_device(2); /* XXX */
uint32_t stat;
int i;
if (dev == NULL)
{
return -ENODEV;
}
stat = dev->intstatus & 0x1f;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org