Re: Bug in 'git am' when applying a broken patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg,

On Mon, Jun 1, 2015 at 3:54 AM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, Jun 01, 2015 at 09:17:59AM +0900, Greg KH wrote:
>> Hi all,
>>
>> I received the patch attached below as part of a submission against the
>> Linux kernel tree.  The patch seems to have been hand-edited, and is not
>> correct, and patch verifies this as being a problem:
>>
>> $ patch -p1 --dry-run < bad_patch.mbox
>> checking file drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
>> patch: **** malformed patch at line 133:                skb_put(skb, sizeof(struct ieee80211_authentication));
>>
>> But git will actually apply it:
>> $ git am -s bad_patch.mbox
>> Applying: staging: rtl8192u: ieee80211: Fix sparse endianness warnings
>>
>> But, there's nothing in the patch at all except the commit message:
>>
>> $ git show HEAD
>> commit f6643dfef5b701db86f23be9ce6fb5b3bafe76b6
>> Author: Gaston Gonzalez <gascoar@xxxxxxxxx>
>> Date:   Sun May 31 12:17:48 2015 -0300
>>
>>     staging: rtl8192u: ieee80211: Fix sparse endianness warnings
>>
>>     Fix the following sparse warnings:
>>
>>     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32: warning: incorrect type in assignment (different base types)
>>     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32:    expected restricted __le16 [usertype] frame_ctl
>>     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32:    got int
>>     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50: warning: invalid assignment: |=
>>     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50:    left side has type restricted __le16
>>     drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50:    right side has type int
>>
>>     Signed-off-by: Gaston Gonzalez <gascoar@xxxxxxxxx>
>>     Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>>
>> $ git diff HEAD^
>> $
>>
>> Any ideas what is going on here?  Shouldn't 'git am' have failed?
>>
>> Oh, I'm using git version 2.4.2 right now.
>>
>> I've asked Gaston for the original patch to verify before he hand-edited
>> it, to verify that git wasn't creating something wrong here, as well.
>
> Gaston sent me his original patch, before he edited it, and it was
> correct, so git is correctly creating the patch, which is good.  So it's
> just a 'git am' issue with a broken patch file.

Yeah, git am is calling 'git apply --index' on the attached patch and
'git apply' doesn't apply it, doesn't warn and exits with code 0.

Thanks,
Christian.
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index d2e8b12..0477ba1 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -660,2 +660,2 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be
 	auth = (struct ieee80211_authentication *)
 		skb_put(skb, sizeof(struct ieee80211_authentication));

-	auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
-	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
+	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+	if (challengelen)
+		auth->header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);

 	auth->header.duration_id = 0x013a; //FIXME

--
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]