Skip to content

Commit ca2f725

Browse files
jilaypandyakartben
authored andcommitted
drivers: stepper: tmc50xx: add a null pointer check
Check if the actual velocity pointer is NULL or not, if its null return -EINVAL in order to avoid null pointer dereferencing later in code Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
1 parent 28be221 commit ca2f725

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/stepper/adi_tmc/tmc50xx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ static int tmc50xx_stepper_set_event_callback(const struct device *dev,
105105

106106
static int read_vactual(const struct tmc50xx_stepper_config *config, int32_t *actual_velocity)
107107
{
108+
__ASSERT(actual_velocity != NULL, "actual_velocity pointer must not be NULL");
108109
int err;
109110

110111
err = tmc50xx_read(config->controller, TMC50XX_VACTUAL(config->index), actual_velocity);

0 commit comments

Comments
 (0)