staging: atomisp: move null check to earlier point
Subsystems (4)
PATCH 1/1 staging: atomisp: move null check to earlier point
find_gmin_subdev function that returns a pointer to struct gmin_subdev can return NULL.
In gmin_v2p8_ctrl there's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:
```
/* Acquired here --------v */
struct gmin_subdev *gs = find_gmin_subdev(subdev);
int ret;
int value;
/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) {
pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",
gs->v2p8_gpio);
ret = gpio_request(gs->v2p8_gpio, "camera_v2p8");
if (!ret)
ret = gpio_direction_output(gs->v2p8_gpio, 0);
if (ret)
pr_err("V2P8 GPIO initialization failed\n");
}
```I have moved the NULL check before deref point.
--- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +6 -1
@@ -871,6 +871,11 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (!gs) { +pr_err ("Unable to find gmin subdevice\n" ); +return -EINVAL ; + } +if (gs->v2p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" , gs->v2p8_gpio);
@@ -881,7 +886,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V2P8 GPIO initialization failed\n" ); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on;
Signature · 1 line
2.27.0
Quoted 25 lines · Cengiz Can
find_gmin_subdevfunction that returns a pointer tostruct gmin_subdevcan return NULL.In
gmin_v2p8_ctrlthere's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:``` /* Acquired here --------v */ struct gmin_subdev *gs = find_gmin_subdev(subdev); int ret; int value; /* v------Dereferenced here */ if (gs->v2p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", gs->v2p8_gpio); ret = gpio_request(gs->v2p8_gpio, "camera_v2p8"); if (!ret) ret = gpio_direction_output(gs->v2p8_gpio, 0); if (ret) pr_err("V2P8 GPIO initialization failed\n"); } ```
Quoted 1 line
I have moved the NULL check before deref point.
"Move the NULL check..."
See Submitting Patches documentation how to avoid "This patch", "I", "we", etc.
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) · line 877
Quoted 12 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3
-0@@ -871,6 +871,11 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (!gs) { +pr_err ("Unable to find gmin subdevice\n" ); +return -EINVAL ;
And here is a change of semantics...
Quoted 1 line
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1
-0+ }
...
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) · line 890
Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1
-1-if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ;
...compared to above.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 26 lines · Andy Shevchenko
Quoted 25 lines · Cengiz Can
find_gmin_subdevfunction that returns a pointer tostruct gmin_subdevcan return NULL.In
gmin_v2p8_ctrlthere's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:``` /* Acquired here --------v */ struct gmin_subdev *gs = find_gmin_subdev(subdev); int ret; int value; /* v------Dereferenced here */ if (gs->v2p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", gs->v2p8_gpio); ret = gpio_request(gs->v2p8_gpio, "camera_v2p8"); if (!ret) ret = gpio_direction_output(gs->v2p8_gpio, 0); if (ret) pr_err("V2P8 GPIO initialization failed\n"); } ```
Quoted 4 lines
Quoted 1 line
I have moved the NULL check before deref point.
"Move the NULL check..."
See Submitting Patches documentation how to avoid "This patch", "I", "we", etc.
I always feel like this is a pointless requirement. We're turning into bureaucracts.
Quoted 9 lines
Quoted 9 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0
-0@@ -871,6 +871,11 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value;
Quoted 6 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) · line 876
Quoted 4 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3
-0+if (!gs) { +pr_err ("Unable to find gmin subdevice\n" ); +return -EINVAL ;And here is a change of semantics...
Yeah. The change of semantics should be documented in the commit message, but it's actually correct. I discussed this with Mauro earlier but my bug reporting script didn't CC a mailing list and I didn't catch it. Mauro suggested:
53 > Yet, it could make sense to have something like:
54 >
55 > if (WARN_ON(!gs))
56 > return -ENODEV;
57 >
58 > at the beginning of the functions that call find_gmin_subdev().regards,
dan carpenter
Quoted 27 lines · On July 30, 2020 11:48:06 Dan Carpenter <[email protected]> wrote:
Quoted 26 lines · Andy Shevchenko
Quoted 25 lines · Cengiz Can
find_gmin_subdevfunction that returns a pointer tostruct gmin_subdevcan return NULL.In
gmin_v2p8_ctrlthere's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:``` /* Acquired here --------v */ struct gmin_subdev *gs = find_gmin_subdev(subdev); int ret; int value; /* v------Dereferenced here */ if (gs->v2p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", gs->v2p8_gpio); ret = gpio_request(gs->v2p8_gpio, "camera_v2p8"); if (!ret) ret = gpio_direction_output(gs->v2p8_gpio, 0); if (ret) pr_err("V2P8 GPIO initialization failed\n"); } ```
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
I have moved the NULL check before deref point.
"Move the NULL check..."
See Submitting Patches documentation how to avoid "This patch", "I", "we", etc.
Noted. Sorry. I'm not a native English speaker.
Quoted 27 lines
Quoted 1 line
I always feel like this is a pointless requirement. We're turning into bureaucracts.
Quoted 10 lines
Quoted 10 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0
-0@@ -871,6 +871,11 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value;Quoted 6 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) · line 876
Quoted 4 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3
-0+if (!gs) { +pr_err ("Unable to find gmin subdevice\n" ); +return -EINVAL ;And here is a change of semantics...
Yeah. The change of semantics should be documented in the commit message, but it's actually correct. I discussed this with Mauro earlier but my bug reporting script didn't CC a mailing list and I didn't catch it. Mauro suggested:
Quoted 6 lines
53 > Yet, it could make sense to have something like: 54 > 55 > if (WARN_ON(!gs)) 56 > return -ENODEV; 57 > 58 > at the beginning of the functions that call find_gmin_subdev().
I will be updating v2 according to this.
Quoted 3 lines
regards,
dan carpenter
PATCH v2 1/1 staging: atomisp: move null check to earlier point
In reply to Dan Carpenterfind_gmin_subdev function that returns a pointer to struct gmin_subdev can return NULL.
In gmin_v2p8_ctrl there's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:
```
/* Acquired here --------v */
struct gmin_subdev *gs = find_gmin_subdev(subdev);
/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) {
...
}
```To avoid the issue, null check has been moved to an earlier point and return semantics has been changed to reflect this exception.
Please do note that this change introduces a new return value to gmin_v2p8_ctrl.
[NEW] - raise a WARN and return -ENODEV if there are no subdevices.
- return result of gpio_request or gpio_direction_output.
- return 0 if GPIO is ON.
- return results of regulator_enable or regulator_disable.
- according to PMIC type, return result of axp_regulator_set or gmin_i2c_write.
- return -EINVAL if unknown PMIC type.
--- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +4 -1
@@ -871,6 +871,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (WARN_ON (!gs)) +return -ENODEV ; +if (gs->v2p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" , gs->v2p8_gpio);
@@ -881,7 +884,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V2P8 GPIO initialization failed\n" ); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on;
Signature · 1 line
2.27.0
Quoted 1 line · Cengiz Can
find_gmin_subdevfunction that returns a pointer to `struct
func() are referred with name followed by parentheses.
Quoted 4 lines
gmin_subdev` can return NULL.
In
gmin_v2p8_ctrlthere's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:
'. ie:' -> ', i.e.:'
Quoted 1 line
```
Instead just shift right by two spaces.
Quoted 9 lines
/* Acquired here --------v */
structgmin_subdev*gs =find_gmin_subdev(subdev);/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) { ... }```
Drop this as per above comment.
Quoted 5 lines
To avoid the issue, null check has been moved to an earlier point and return semantics has been changed to reflect this exception.
Please do note that this change introduces a new return value to
gmin_v2p8_ctrl.
This rather should explain better the semantics change, e.g.
"Now the function() refuses to take NULL argument and returns an error. We also WARN() for sake of the debugging."
Quoted 7 lines
[NEW] - raise a WARN and return
-ENODEVif there are no subdevices.
- return result ofgpio_requestorgpio_direction_output.
- return 0 if GPIO is ON.
- return results ofregulator_enableorregulator_disable.
- according to PMIC type, return result ofaxp_regulator_setorgmin_i2c_write.
- return-EINVALif unknown PMIC type.
This has to go after cutter '---' line below.
Quoted 1 line
Caught-by: Coverity Static Analyzer CID 1465536
Reported-by:
And as discussed previously,
Suggested-by: Mauro ...
Quoted 1 line
Signed-off-by Cengiz Can <[email protected]>
The code looks good enough (WARN() will probably go away when driver gains better quality).
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 1/1 staging: atomisp: move null check to earlier point
find_gmin_subdev() that returns a pointer to struct gmin_subdev can return NULL.
In gmin_v2p8_ctrl() there's a call to this function but the possibility of a NULL was not checked before its being dereferenced, i.e.:
/* Acquired here --------v */
struct gmin_subdev *gs = find_gmin_subdev(subdev);
/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) {
...
}With this change we're null checking find_gmin_subdev() result and return we return an error if that's the case. We also WARN() for the sake of debugging.
---
Please do note that this change introduces a new return value to
gmin_v2p8_ctrl.
[NEW] - raise a WARN and return -ENODEV if there are no subdevices.
- return result of gpio_request or gpio_direction_output.
- return 0 if GPIO is ON.
- return results of regulator_enable or regulator_disable.
- according to PMIC type, return result of axp_regulator_set or gmin_i2c_write.
- return -EINVAL if unknown PMIC type.
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +4 -1
@@ -871,6 +871,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (WARN_ON (!gs)) +return -ENODEV ; +if (gs->v2p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" , gs->v2p8_gpio);
@@ -881,7 +884,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V2P8 GPIO initialization failed\n" ); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on;
Signature · 1 line
2.27.0
PATCH v4 1/1 staging: atomisp: move null check to earlier point
In reply to Andy Shevchenkofind_gmin_subdev() that returns a pointer to struct gmin_subdev can return NULL.
In gmin_v2p8_ctrl() there's a call to this function but the possibility of a NULL was not checked before its being dereferenced, i.e.:
/* Acquired here --------v */
struct gmin_subdev *gs = find_gmin_subdev(subdev);
/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) {
...
}With this change we're null checking find_gmin_subdev() result and we return an error if that's the case. We also WARN() for the sake of debugging.
---
Please do note that this change introduces a new return value to gmin_v2p8_ctrl.
[NEW] - raise a WARN and return -ENODEV if there are no subdevices.
- return result of gpio_request or gpio_direction_output.
- return 0 if GPIO is ON.
- return results of regulator_enable or regulator_disable.
- according to PMIC type, return result of axp_regulator_set or gmin_i2c_write.
- return -EINVAL if unknown PMIC type.
Patch Changelog:
v4: Fix minor typo in commit message
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +4 -1
@@ -871,6 +871,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (WARN_ON (!gs)) +return -ENODEV ; +if (gs->v2p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" , gs->v2p8_gpio);
@@ -881,7 +884,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V2P8 GPIO initialization failed\n" ); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on;
Signature · 1 line
2.27.0
PATCH v5 1/1 staging: atomisp: move null check to earlier point
In reply to Andy Shevchenkofind_gmin_subdev() that returns a pointer to struct gmin_subdev can return NULL.
In gmin_v2p8_ctrl() there's a call to this function but the possibility of a NULL was not checked before its being dereferenced, i.e.:
/* Acquired here --------v */
struct gmin_subdev *gs = find_gmin_subdev(subdev);
/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) {
...
}With this change we're null checking find_gmin_subdev() result and we return an error if that's the case. We also WARN() for the sake of debugging.
---
Please do note that this change introduces a new return value to gmin_v2p8_ctrl().
[NEW] - raise a WARN and return -ENODEV if there are no subdevices.
- return result of gpio_request or gpio_direction_output.
- return 0 if GPIO is ON.
- return results of regulator_enable or regulator_disable.
- according to PMIC type, return result of axp_regulator_set or gmin_i2c_write.
- return -EINVAL if unknown PMIC type.
Patch Changelog:
v4: Fix minor typo in commit message
v5: Remove typo from email subject
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +4 -1
@@ -871,6 +871,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (WARN_ON (!gs)) +return -ENODEV ; +if (gs->v2p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" , gs->v2p8_gpio);
@@ -881,7 +884,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V2P8 GPIO initialization failed\n" ); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on;
Signature · 1 line
2.27.0
PATCH v6 1/1 staging: atomisp: move null check to earlier point
In reply to Andy Shevchenkofind_gmin_subdev() that returns a pointer to struct gmin_subdev can return NULL.
In gmin_v2p8_ctrl() there's a call to this function but the possibility of a NULL was not checked before its being dereferenced, i.e.:
/* Acquired here --------v */
struct gmin_subdev *gs = find_gmin_subdev(subdev);
/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) {
...
}With this change we're null checking find_gmin_subdev() result and we return an error if that's the case. We also WARN() for the sake of debugging.
---
Please do note that this change introduces a new return value to gmin_v2p8_ctrl().
[NEW] - raise a WARN and return -ENODEV if there are no subdevices.
- return result of gpio_request or gpio_direction_output.
- return 0 if GPIO is ON.
- return results of regulator_enable or regulator_disable.
- according to PMIC type, return result of axp_regulator_set or gmin_i2c_write.
- return -EINVAL if unknown PMIC type.
Patch Changelog:
v4: Fix minor typo in commit message
v5: Remove typo from email subject
v6: Remove duplicate Signed-off-by tag
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +4 -1
@@ -871,6 +871,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (WARN_ON (!gs)) +return -ENODEV ; +if (gs->v2p8_gpio >=0 ) {pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" , gs->v2p8_gpio);
@@ -881,7 +884,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)pr_err ("V2P8 GPIO initialization failed\n" ); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on;
Signature · 1 line
2.27.0
Hello Andy,
Can I get some feedback on v6 please?
I hope it suits your standards this time.
Thank you
Quoted 70 lines · On August 2, 2020 01:02:22 Cengiz Can <[email protected]> wrote:
find_gmin_subdev()that returns a pointer tostruct gmin_subdevcan return NULL.In
gmin_v2p8_ctrl()there's a call to this function but the possibility of a NULL was not checked before its being dereferenced, i.e.:/* Acquired here --------v */
structgmin_subdev*gs =find_gmin_subdev(subdev);/* v------Dereferenced here */
if (gs->v2p8_gpio >= 0) { ...}
With this change we're null checking
find_gmin_subdev()result and we return an error if that's the case. We alsoWARN()for the sake of debugging.Signed-off-by Cengiz Can <[email protected]>Reported-by Coverity Static Analyzer CID 1465536Suggested-by Mauro Carvalho Chehab <[email protected]>---
Please do note that this change introduces a new return value to
gmin_v2p8_ctrl().[NEW] - raise a WARN and return
-ENODEVif there are no subdevices.
- return result ofgpio_requestorgpio_direction_output.
- return 0 if GPIO is ON.
- return results ofregulator_enableorregulator_disable.
- according to PMIC type, return result ofaxp_regulator_setorgmin_i2c_write.
- return-EINVALif unknown PMIC type.Patch Changelog:
v4: Fix minor typo in commit message
v5: Remove typo from email subject
v6: Remove duplicate Signed-off-by tag
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +3
-0@@ -871,6 +871,9 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)int ret;int value; +if (WARN_ON (!gs)) +return -ENODEV ; +if (gs->v2p8_gpio >=0 ) { pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",gs->v2p8_gpio);drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1
-2@@ -881,7 +884,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) pr_err("V2P8 GPIO initialization failed\n"); } -if (!gs || gs->v2p8_on == on) +if (gs->v2p8_on == on)return 0 ; gs->v2p8_on = on; --2.27.0
Greg KH
maintainerQuoted 3 lines · Cengiz Can
Hello Andy,
Can I get some feedback on v6 please?
It's been 4 days, in the middle of a merge window, please give people a chance to catch up on other things...
and do not top post please.
thanks,
greg k-h
Quoted 8 lines · On August 6, 2020 21:39:21 Greg KH <[email protected]> wrote:
Quoted 3 lines · Cengiz Can
Hello Andy,
Can I get some feedback on v6 please?
It's been 4 days, in the middle of a merge window, please give people a chance to catch up on other things...
I wasn't aware of that we're currently in a merge window. Sorry for my impatience.
Quoted 2 lines
and do not top post please.
Sorry. I was tricked by my mobile email client.
Quoted 4 lines
thanks,
greg k-h
Thanks again and I wish a smooth merge window to all maintainers.
Cengiz Can
Quoted 27 lines · Dan Carpenter
Quoted 26 lines · Andy Shevchenko
Quoted 25 lines · Cengiz Can
find_gmin_subdevfunction that returns a pointer tostruct gmin_subdevcan return NULL.In
gmin_v2p8_ctrlthere's a call to this function but the possibility of a NULL was not checked before its being dereferenced. ie:``` /* Acquired here --------v */ struct gmin_subdev *gs = find_gmin_subdev(subdev); int ret; int value; /* v------Dereferenced here */ if (gs->v2p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", gs->v2p8_gpio); ret = gpio_request(gs->v2p8_gpio, "camera_v2p8"); if (!ret) ret = gpio_direction_output(gs->v2p8_gpio, 0); if (ret) pr_err("V2P8 GPIO initialization failed\n"); } ```
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
I have moved the NULL check before deref point.
"Move the NULL check..."
See Submitting Patches documentation how to avoid "This patch", "I", "we", etc.I always feel like this is a pointless requirement. We're turning into bureaucrats.
There is a danger of that, and I'm more guilty than most. But I do think there's value in consistent style because it allows readers to focus on the content instead of being distracted by different margins, grammar ("move vs. moved"), paragraph styles, quoting conventions, etc.
Ideally we would scan previous commit logs (and the existing code!) and make new changes fit seamlessly so it looks like everything was done at the same time by the same person.
But often that doesn't happen. Sometimes I take the liberty to tweak things as I apply them to try to avoid trivial rework.
Bjorn
Beyond that, though, I feel like the rules are stupid because I've seen more than a couple commit messages which were contorted to avoid imperative. My own standard for commit messages is that 1) Is the problem explained, especially what it looks like to user space? 2) Is it clear what the solution is? 3) Does the patch itself raise any questions that I can't figure out and which aren't explained in the commit message. And I figure I'm not a domain expert but if I can understand the commit message probably anyone can.
We've got people who speak English as a second language and then start imposing pointless rules on top? It's crazy. I've had to ask someone recently to redo a commit message and it seemed very obvious they were focused on nonsense about imperative and avoiding saying "this patch" to the extent that I literally could not figure out what they were saying. When I read the patch, of course, I could see what they were doing but from the commit message it was impossible.
regards,
dan carpenter