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

From: Greg KH <[email-masked]>
Date: Mon, 1 Jun 2015 10:54:28 +0900

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 <[email-masked]>
> 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 <[email-masked]>
>     Signed-off-by: Greg Kroah-Hartman <[email-masked]>
> 
> $ 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.

thanks,

greg k-h