Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buggy code related to CONFIG_FORTIFY_SOURCE Kernel versions >4.12 #2

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DPO_RT5572_LinuxSTA_2.6.1.3_20121022/chips/rt30xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ VOID RT30xxLoadRFSleepModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
UINT32 MACValue;
UINT32 MACValue __attribute__((unused));

{
/* RF_BLOCK_en. RF R1 register Bit 0 to 0*/
Expand Down Expand Up @@ -513,7 +513,7 @@ VOID RT30xxReverseRFSleepModeSetup(
IN BOOLEAN FlgIsInitState)
{
UCHAR RFValue;
UINT32 MACValue;
UINT32 MACValue __attribute__((unused)) ;

if(!IS_RT3572(pAd))
{
Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/chips/rt3593.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ VOID RT3593ReverseRFSleepModeSetup(
{

UCHAR rfreg;
UINT32 MACValue;
UINT32 MACValue __attribute__((unused));

RT30xxReadRFRegister(pAd, RF_R01, &rfreg);
rfreg = ((rfreg & ~0x01) | 0x01); /* vco_en*/
Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/chips/rt35xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ VOID RT35xxLoadRFSleepModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
UINT32 MACValue;
UINT32 MACValue __attribute__((unused));
#ifdef RT35xx
if(IS_RT3572(pAd))
RT30xxWriteRFRegister(pAd, RF_R08, 0x00);
Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/chips/rt5592.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ VOID RT5592LoadRFNormalModeSetup(
RT30xxWriteRFRegister(pAd, RF_R30, RFValue);
}

static VOID RT5592FilterCalibration(IN PRTMP_ADAPTER pAd)
static VOID RT5592FilterCalibration(IN PRTMP_ADAPTER pAd)
{

UCHAR FilterTarget = 0x13;
Expand Down
4 changes: 2 additions & 2 deletions DPO_RT5572_LinuxSTA_2.6.1.3_20121022/common/cmm_asic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2742,10 +2742,10 @@ VOID AsicAddPairwiseKeyEntry(
{
INT i;
ULONG offset;
PUCHAR pKey = pCipherKey->Key;
PUCHAR pKey __attribute__((unused)) = pCipherKey->Key;
PUCHAR pTxMic = pCipherKey->TxMic;
PUCHAR pRxMic = pCipherKey->RxMic;
UCHAR CipherAlg = pCipherKey->CipherAlg;
UCHAR CipherAlg __attribute__((unused)) = pCipherKey->CipherAlg;

/* EKEY*/
offset = PAIRWISE_KEY_TABLE_BASE + (WCID * HW_KEY_ENTRY_SIZE);
Expand Down
14 changes: 7 additions & 7 deletions DPO_RT5572_LinuxSTA_2.6.1.3_20121022/common/cmm_wpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,12 +1156,12 @@ VOID PeerPairMsg4Action(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN MLME_QUEUE_ELEM *Elem)
{
PEAPOL_PACKET pMsg4;
PHEADER_802_11 pHeader;
{
PEAPOL_PACKET pMsg4;
PHEADER_802_11 pHeader;
UINT MsgLen;
BOOLEAN Cancelled;
UCHAR group_cipher = Ndis802_11WEPDisabled;
BOOLEAN Cancelled;
UCHAR group_cipher __attribute__((unused)) = Ndis802_11WEPDisabled;

DBGPRINT(RT_DEBUG_TRACE, ("===> PeerPairMsg4Action\n"));

Expand Down Expand Up @@ -1531,8 +1531,8 @@ VOID PeerGroupMsg2Action(
UINT Len;
PUCHAR pData;
BOOLEAN Cancelled;
PEAPOL_PACKET pMsg2;
UCHAR group_cipher = Ndis802_11WEPDisabled;
PEAPOL_PACKET pMsg2;
UCHAR group_cipher __attribute__((unused)) = Ndis802_11WEPDisabled;

DBGPRINT(RT_DEBUG_TRACE, ("===> PeerGroupMsg2Action \n"));

Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/common/frq_cal.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ VOID FrequencyCalibrationMode(
UINT8 Mode)
{
UCHAR RFValue = 0;
UCHAR PreRFValue = 0;
UCHAR PreRFValue __attribute__((unused)) = 0;

if (Mode == FREQ_CAL_MODE0)
{
Expand Down
12 changes: 8 additions & 4 deletions DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,9 @@ PNDIS_PACKET duplicate_pkt(
MEM_DBG_PKT_ALLOC_INC(skb);

skb_reserve(skb, 2);
NdisMoveMemory(skb->tail, pHeader802_3, HdrLen);
NdisMoveMemory(skb_tail_pointer(skb), pHeader802_3, HdrLen);
skb_put(skb, HdrLen);
NdisMoveMemory(skb->tail, pData, DataSize);
NdisMoveMemory(skb_tail_pointer(skb), pData, DataSize);
skb_put(skb, DataSize);
skb->dev = pNetDev; /*get_netdev_from_bssid(pAd, FromWhichBSSID); */
pPacket = OSPKT_TO_RTPKT(skb);
Expand Down Expand Up @@ -1110,7 +1110,9 @@ void RtmpOSFileSeek(RTMP_OS_FD osfd,

int RtmpOSFileRead(RTMP_OS_FD osfd,
char *pDataPtr, int readLen) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
return kernel_read(osfd, pDataPtr, readLen, &osfd->f_pos);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
return vfs_read(osfd, pDataPtr, readLen, &osfd->f_pos);
#else
/* The object must have a read method */
Expand All @@ -1125,7 +1127,9 @@ int RtmpOSFileRead(RTMP_OS_FD osfd,

int RtmpOSFileWrite(RTMP_OS_FD osfd,
char *pDataPtr, int writeLen) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
return kernel_write(osfd, pDataPtr, writeLen, &osfd->f_pos);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
return vfs_write(osfd, pDataPtr, writeLen, &osfd->f_pos);
#else
return osfd->f_op->write(osfd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Return Value:
*/
void dump_urb(VOID *purb_org)
{
struct urb *purb = (struct urb *)purb_org;
struct urb *purb __attribute__((unused)) = (struct urb *)purb_org;

DBGPRINT(RT_DEBUG_TRACE,("urb :0x%08lx\n", (unsigned long)purb));
DBGPRINT(RT_DEBUG_TRACE,("\tdev :0x%08lx\n", (unsigned long)purb->dev));
Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/sta_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ int rt_ioctl_iwaplist(struct net_device *dev,
set_quality(pAd, &qual[i], pList); /*&pAd->ScanTab.BssEntry[i]); */
}
data->length = i;
memcpy(extra, &addr, i*sizeof(addr[0]));
memcpy(extra, addr, i*sizeof(addr[0]));
data->flags = 1; /* signal quality present (sort of) */
memcpy(extra + i*sizeof(addr[0]), &qual, i*sizeof(qual[i]));

Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/rate_ctrl/ra_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ VOID MlmeRALog(
#endif /* DBG_CTRL_SUPPORT */
)
{
BOOLEAN stbc, csd=FALSE;
BOOLEAN stbc, csd __attribute__((unused))=FALSE;
ULONG tp;

/* Get STBC and StreamMode state */
Expand Down
6 changes: 3 additions & 3 deletions DPO_RT5572_LinuxSTA_2.6.1.3_20121022/sta/rtmp_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ VOID STAHandleRxDataFrame(
MAC_TABLE_ENTRY *pEntry = NULL;
UCHAR FromWhichBSSID = BSS0;
UCHAR UserPriority = 0;
UCHAR OldPwrMgmt = PWR_ACTIVE;
FRAME_CONTROL *pFmeCtrl = &pHeader->FC;
UCHAR OldPwrMgmt __attribute__((unused)) = PWR_ACTIVE;
FRAME_CONTROL *pFmeCtrl __attribute__((unused)) = &pHeader->FC;

if ((pHeader->FC.FrDs == 1) && (pHeader->FC.ToDs == 1)) {
#ifdef CLIENT_WDS
Expand Down Expand Up @@ -1734,7 +1734,7 @@ VOID STAFindCipherAlgorithm(
if (KeyIdx == 0xff)
CipherAlg = CIPHER_NONE;
else if ((Cipher == Ndis802_11EncryptionDisabled)
|| (((Cipher == Ndis802_11Encryption1Enabled) && (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 0))
|| (((Cipher == Ndis802_11Encryption1Enabled) && (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 0))
|| (((Cipher == Ndis802_11Encryption2Enabled) || (Cipher == Ndis802_11Encryption3Enabled)
|| (Cipher == Ndis802_11Encryption4Enabled)) && pMacEntry && (pMacEntry->PairwiseKey.KeyLen == 0))
&& (!ADHOC_ON(pAd))) || (ADHOC_ON(pAd) && (pAd->SharedKey[BSS0][KeyIdx].KeyLen == 0)))
Expand Down
2 changes: 1 addition & 1 deletion DPO_RT5572_LinuxSTA_2.6.1.3_20121022/sta/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ VOID MlmeForceJoinReqAction(
UCHAR ExtRateLen;
UCHAR ASupRate[] = {0x8C, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6C};
UCHAR ASupRateLen = sizeof(ASupRate)/sizeof(UCHAR);
MLME_JOIN_REQ_STRUCT *pInfo = (MLME_JOIN_REQ_STRUCT *)(Elem->Msg);
MLME_JOIN_REQ_STRUCT *pInfo __attribute__((unused)) = (MLME_JOIN_REQ_STRUCT *)(Elem->Msg);

#ifdef CONFIG_PM
#ifdef USB_SUPPORT_SELECTIVE_SUSPEND
Expand Down
Binary file removed DPO_RT5572_LinuxSTA_2.6.1.3_20121022/tools/bin2h
Binary file not shown.