Skip to content

Commit

Permalink
fmu:Add Range checking for PWM5 modes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Sidrane authored and LorenzMeier committed Oct 23, 2018
1 parent d832b4f commit 99294b2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/drivers/px4fmu/fmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1835,10 +1835,14 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)

/* FALLTHROUGH */
case PWM_SERVO_SET(5):
if (_mode < MODE_6PWM) {
ret = -EINVAL;
break;
}

/* FALLTHROUGH */
case PWM_SERVO_SET(4):
if (_mode < MODE_6PWM) {
if (_mode < MODE_5PWM1CAP) {
ret = -EINVAL;
break;
}
Expand Down Expand Up @@ -1901,12 +1905,17 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)

/* FALLTHROUGH */
case PWM_SERVO_GET(5):
case PWM_SERVO_GET(4):
if (_mode < MODE_6PWM) {
ret = -EINVAL;
break;
}

case PWM_SERVO_GET(4):
if (_mode < MODE_5PWM1CAP) {
ret = -EINVAL;
break;
}

#endif

/* FALLTHROUGH */
Expand Down

0 comments on commit 99294b2

Please sign in to comment.